Horde_Cache::exists PHP Method

exists() public method

Checks if a given key exists in the cache, valid for the given lifetime.
public exists ( string $key, integer $lifetime = 1 ) : boolean
$key string Cache key to check.
$lifetime integer Lifetime of the key in seconds.
return boolean Existence.
    public function exists($key, $lifetime = 1)
    {
        return $this->_storage->exists($key, $lifetime);
    }

Usage Example

コード例 #1
0
ファイル: Base.php プロジェクト: raz0rsdge/horde
 /**
  * TODO
  *
  * @param array $opts  Options:
  * - 'file': (string) The filename to process.
  *           REQUIRED for this driver.
  * - 'range': (array) The patchsets to process.
  *            DEFAULT: None (all patchsets are processed).
  * - 'timezone': (string) The current timezone.
  *
  * @return Horde_Vcs_Patchset  Patchset object.
  */
 public function getPatchset($opts = array())
 {
     $class = 'Horde_Vcs_Patchset_' . $this->_driver;
     if (!is_array($opts)) {
         $opts = array();
     }
     ksort($opts);
     $cacheId = implode('|', array($class, $this->sourceroot, serialize($opts), $this->_cacheVersion));
     if (!empty($this->_cache)) {
         if (isset($opts['file']) && file_exists($opts['file'])) {
             $ctime = time() - filemtime($opts['file']);
         } else {
             $ctime = 60;
         }
         if ($this->_cache->exists($cacheId, $ctime)) {
             return unserialize($this->_cache->get($cacheId, $ctime));
         }
     }
     $ob = new $class($this, $opts);
     if (!empty($this->_cache)) {
         $this->_cache->set($cacheId, serialize($ob));
     }
     return $ob;
 }
All Usage Examples Of Horde_Cache::exists