1
0
mirror of https://github.com/danog/parallel.git synced 2025-01-23 06:21:12 +01:00
parallel/lib/Worker/Environment.php

37 lines
823 B
PHP
Raw Normal View History

2016-08-21 23:40:48 -05:00
<?php declare(strict_types = 1);
2015-09-09 23:29:41 -05:00
2016-08-18 11:04:48 -05:00
namespace Amp\Concurrent\Worker;
2015-09-09 23:29:41 -05:00
2016-08-18 11:04:48 -05:00
interface Environment extends \ArrayAccess, \Countable {
2015-09-09 23:29:41 -05:00
/**
* @param string $key
*
* @return bool
*/
2016-01-23 00:00:56 -06:00
public function exists(string $key);
2015-09-09 23:29:41 -05:00
/**
* @param string $key
*
2015-09-10 18:37:34 -05:00
* @return mixed|null Returns null if the key does not exist.
2015-09-09 23:29:41 -05:00
*/
2016-01-23 00:00:56 -06:00
public function get(string $key);
2015-09-09 23:29:41 -05:00
/**
* @param string $key
2015-09-10 18:37:34 -05:00
* @param mixed $value Using null for the value deletes the key.
2015-09-11 10:38:13 -05:00
* @param int $ttl Number of seconds until data is automatically deleted. Use 0 for unlimited TTL.
2015-09-09 23:29:41 -05:00
*/
2016-01-23 00:00:56 -06:00
public function set(string $key, $value, int $ttl = 0);
2015-09-10 18:37:34 -05:00
/**
* @param string $key
*/
2016-01-23 00:00:56 -06:00
public function delete(string $key);
2015-09-10 18:37:34 -05:00
/**
* Removes all values.
*/
2016-01-14 17:44:43 -06:00
public function clear();
2015-09-09 23:29:41 -05:00
}