2016-08-22 06:40:48 +02:00
|
|
|
<?php declare(strict_types = 1);
|
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
|
|
|
|
2016-08-18 18:04:48 +02:00
|
|
|
interface Environment extends \ArrayAccess, \Countable {
|
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
|
|
|
*/
|
2016-01-23 07:00:56 +01:00
|
|
|
public function set(string $key, $value, int $ttl = 0);
|
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
|
|
|
}
|