Icicle\Concurrent\Worker\BasicEnvironment::set PHP Метод

set() публичный Метод

public set ( string $key, mixed $value, integer $ttl )
$key string
$value mixed Using null for the value deletes the key.
$ttl integer Number of seconds until data is automatically deleted. Use 0 for unlimited TTL.
    public function set(string $key, $value, int $ttl = 0)
    {
        if (null === $value) {
            $this->delete($key);
            return;
        }
        $ttl = (int) $ttl;
        if (0 > $ttl) {
            $ttl = 0;
        }
        if (0 !== $ttl) {
            $this->ttl[$key] = $ttl;
            $this->expire[$key] = time() + $ttl;
            $this->queue->insert($key, -$this->expire[$key]);
            if (!$this->timer->isPending()) {
                $this->timer->start();
            }
        } else {
            unset($this->expire[$key], $this->ttl[$key]);
        }
        $this->data[$key] = $value;
    }