1
0
mirror of https://github.com/danog/parallel.git synced 2025-01-22 22:11:11 +01:00
parallel/lib/Worker/Environment.php

38 lines
791 B
PHP
Raw Normal View History

2016-12-29 19:16:04 -06:00
<?php
2015-09-09 23:29:41 -05:00
2016-08-23 16:47:40 -05:00
namespace Amp\Parallel\Worker;
2015-09-09 23:29:41 -05:00
2018-10-07 09:50:45 -05:00
interface Environment extends \ArrayAccess
{
2015-09-09 23:29:41 -05:00
/**
* @param string $key
*
* @return bool
*/
2018-10-25 09:38:38 -05:00
public function exists(string $key): bool;
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
*/
public function set(string $key, $value, int $ttl = null);
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
}