src/cache/ApcCache.php
public function isCached($key) {
        // The actual working horse. The method does not only check existence of the key. It retrieves the value and stores
        // it in the local reference pool, so following cache queries can use the local reference.

        // check local reference pool
        if ($this->getReferencePool()->isCached($key))
            return true;

        // query APC cache
        $data = apc_fetch($this->namespace.'::'.$key);
        if (!$data)                                     // cache miss
            return false;

        // cache hit
        $created = $data[0];                            // data: [created, expires, serialized([$value, $dependency])]
        $expires = $data[1];

        // check expiration
        if ($expires && $created+$expires < time()) {
            $this->drop($key);
            return false;
        }

        // unpack serialized value
        $data[2]    = unserialize($data[2]);
        $value      = $data[2][0];
        $dependency = $data[2][1];

        // check dependency
        if ($dependency) {
            $minValid = $dependency->getMinValidity();

            if ($minValid) {
                if (time() > $created+$minValid) {
                    if (!$dependency->isValid()) {
                        $this->drop($key);
                        return false;
                    }
                    // reset the creation time by writing back to the cache (resets $minValid period)
                    return $this->set($key, $value, $expires, $dependency);
                }
            }
            elseif (!$dependency->isValid()) {
                $this->drop($key);
                return false;
            }
        }

        // store the validated value in the local reference pool
        $this->getReferencePool()->set($key, $value, Cache::EXPIRES_NEVER, $dependency);
        return true;
    }
public function isCached($key) {
        // The actual working horse. The method does not only check existence of the key. It retrieves the value and stores
        // it in the local reference pool, so following cache queries can use the local reference.

        // check local reference pool
        if ($this->getReferencePool()->isCached($key))
            return true;

        // query APC cache
        $data = apc_fetch($this->namespace.'::'.$key);
        if (!$data)                                     // cache miss
            return false;

        // cache hit
        $created = $data[0];                            // data: [created, expires, serialized([$value, $dependency])]
        $expires = $data[1];

        // check expiration
        if ($expires && $created+$expires < time()) {
            $this->drop($key);
            return false;
        }

        // unpack serialized value
        $data[2]    = unserialize($data[2]);
        $value      = $data[2][0];
        $dependency = $data[2][1];

        // check dependency
        if ($dependency) {
            $minValid = $dependency->getMinValidity();

            if ($minValid) {
                if (time() > $created+$minValid) {
                    if (!$dependency->isValid()) {
                        $this->drop($key);
                        return false;
                    }
                    // reset the creation time by writing back to the cache (resets $minValid period)
                    return $this->set($key, $value, $expires, $dependency);
                }
            }
            elseif (!$dependency->isValid()) {
                $this->drop($key);
                return false;
            }
        }

        // store the validated value in the local reference pool
        $this->getReferencePool()->set($key, $value, Cache::EXPIRES_NEVER, $dependency);
        return true;
    }
public function isCached ( $ key ) { // The actual working horse. The method does not only check existence of the key. It retrieves the value and stores // it in the local reference pool, so following cache queries can use the local reference. // check local reference pool if ( $ this -> getReferencePool ( ) -> isCached ( $ key ) ) return true ; // query APC cache $ data = apc_fetch ( $ this -> namespace . '::' . $ key ) ; if ( ! $ data ) // cache miss return false ; // cache hit $ created = $ data [ 0 ] ; // data: [created, expires, serialized([$value, $dependency])] $ expires = $ data [ 1 ] ; // check expiration if ( $ expires && $ created + $ expires < time ( ) ) { $ this -> drop ( $ key ) ; return false ; } // unpack serialized value $ data [ 2 ] = unserialize ( $ data [ 2 ] ) ; $ value = $ data [ 2 ] [ 0 ] ; $ dependency = $ data [ 2 ] [ 1 ] ; // check dependency if ( $ dependency ) { $ minValid = $ dependency -> getMinValidity ( ) ; if ( $ minValid ) { if ( time ( ) > $ created + $ minValid ) { if ( ! $ dependency -> isValid ( ) ) { $ this -> drop ( $ key ) ; return false ; } // reset the creation time by writing back to the cache (resets $minValid period) return $ this -> set ( $ key , $ value , $ expires , $ dependency ) ; } } elseif ( ! $ dependency -> isValid ( ) ) { $ this -> drop ( $ key ) ; return false ; } } // store the validated value in the local reference pool $ this -> getReferencePool ( ) -> set ( $ key , $ value , Cache :: EXPIRES_NEVER , $ dependency ) ; return true ; }
Whether a value with the specified key exists in the cache.

@param  string $key

@return bool
Whether a value with the specified key exists in the cache .