2016-12-30 02:16:04 +01:00
|
|
|
<?php
|
2015-09-10 06:29:41 +02:00
|
|
|
|
2016-08-23 23:47:40 +02:00
|
|
|
namespace Amp\Parallel\Worker;
|
2015-09-10 06:29:41 +02:00
|
|
|
|
2018-10-07 16:50:45 +02:00
|
|
|
interface Environment extends \ArrayAccess
|
|
|
|
{
|
2015-09-10 06:29:41 +02:00
|
|
|
/**
|
|
|
|
* @param string $key
|
|
|
|
*
|
|
|
|
* @return bool
|
|
|
|
*/
|
2016-01-23 07:00:56 +01:00
|
|
|
public function exists(string $key);
|
2015-09-10 06:29:41 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @param string $key
|
|
|
|
*
|
2015-09-11 01:37:34 +02:00
|
|
|
* @return mixed|null Returns null if the key does not exist.
|
2015-09-10 06:29:41 +02:00
|
|
|
*/
|
2016-01-23 07:00:56 +01:00
|
|
|
public function get(string $key);
|
2015-09-10 06:29:41 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @param string $key
|
2015-09-11 01:37:34 +02:00
|
|
|
* @param mixed $value Using null for the value deletes the key.
|
2015-09-11 17:38:13 +02:00
|
|
|
* @param int $ttl Number of seconds until data is automatically deleted. Use 0 for unlimited TTL.
|
2015-09-10 06:29:41 +02:00
|
|
|
*/
|
2017-07-28 06:47:36 +02:00
|
|
|
public function set(string $key, $value, int $ttl = null);
|
2015-09-11 01:37:34 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @param string $key
|
|
|
|
*/
|
2016-01-23 07:00:56 +01:00
|
|
|
public function delete(string $key);
|
2015-09-11 01:37:34 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Removes all values.
|
|
|
|
*/
|
2016-01-15 00:44:43 +01:00
|
|
|
public function clear();
|
2015-09-10 06:29:41 +02:00
|
|
|
}
|