Cachearium\Backend\CacheMemcached::get PHP Method

get() public method

(non-PHPdoc)
See also: Cachearium\Backend\CacheRAM::get()
public get ( CacheKey $k )
$k Cachearium\CacheKey
    public function get(CacheKey $k)
    {
        // @codeCoverageIgnoreStart
        if (!$this->enabled) {
            throw new NotCachedException();
        }
        // @codeCoverageIgnoreEnd
        // see if it is in RAM
        $should_log = $this->should_log;
        try {
            $this->should_log = false;
            $data = parent::get($k);
            $this->should_log = $should_log;
            $this->log(CacheLogEnum::PREFETCHED, $k);
            return $data;
        } catch (NotCachedException $e) {
            $this->should_log = $should_log;
        }
        $group = $this->hashKey($k);
        $this->fetches++;
        $retval = $this->memcached->get($group);
        $this->log($retval !== false ? CacheLogEnum::ACCESSED : CacheLogEnum::MISSED, $k);
        if ($retval == false) {
            throw new NotCachedException();
        }
        $x = unserialize($retval);
        if ($x === false) {
            throw new NotCachedException();
        }
        parent::store($x, $k);
        return $x;
    }