MatthiasMullie\Scrapbook\Adapters\MemoryStore::exists PHP Method

exists() protected method

Checks if a value exists in cache and is not yet expired.
protected exists ( string $key ) : boolean
$key string
return boolean
    protected function exists($key)
    {
        if (!array_key_exists($key, $this->items)) {
            // key not in cache
            return false;
        }
        $expire = $this->items[$key][1];
        if ($expire !== 0 && $expire < time()) {
            // not permanent & already expired
            $this->size -= strlen($this->items[$key][0]);
            unset($this->items[$key]);
            return false;
        }
        $this->lru($key);
        return true;
    }