Nette\Caching\Storages\MemcachedStorage::read PHP Method

read() public method

Read from cache.
public read ( $key ) : mixed | null
return mixed | null
    public function read($key)
    {
        $key = urlencode($this->prefix . $key);
        $meta = $this->memcache->get($key);
        if (!$meta) {
            return NULL;
        }
        // meta structure:
        // array(
        //     data => stored data
        //     delta => relative (sliding) expiration
        //     callbacks => array of callbacks (function, args)
        // )
        // verify dependencies
        if (!empty($meta[self::META_CALLBACKS]) && !Cache::checkCallbacks($meta[self::META_CALLBACKS])) {
            $this->memcache->delete($key, 0);
            return NULL;
        }
        if (!empty($meta[self::META_DELTA])) {
            $this->memcache->replace($key, $meta, 0, $meta[self::META_DELTA] + time());
        }
        return $meta[self::META_DATA];
    }