1
0
mirror of https://github.com/danog/parallel.git synced 2024-11-27 04:44:56 +01:00

Fix TTL update in get() and set()

This commit is contained in:
Aaron Piotrowski 2015-09-11 00:18:37 -05:00
parent fbd77068c9
commit 6c71eb515f

View File

@ -78,7 +78,7 @@ class Environment implements \ArrayAccess, \Countable
{
$key = (string) $key;
if (!isset($this->ttl[$key]) || 0 !== $this->ttl[$key]) {
if (isset($this->ttl[$key]) && 0 !== $this->ttl[$key]) {
$this->expire[$key] = time() + $this->ttl[$key];
$this->queue->insert($key, -$this->expire[$key]);
}
@ -113,6 +113,9 @@ class Environment implements \ArrayAccess, \Countable
if (!$this->timer->isPending()) {
$this->timer->start();
}
} else {
unset($this->expire[$key]);
unset($this->ttl[$key]);
}
$this->data[$key] = $value;