Inheritance: extends ObjectCache
 /**
  * Count how often the given event occured, within the current cache-timeframe.
  *
  * @param SystemEvent $evt
  * @throws Exception
  *
  * @return int The number of equal-hashed events
  */
 public function count(SystemEvent $evt)
 {
     if (empty($evt->hash)) {
         throw new Exception("Hash is not expected to be empty!");
     }
     if ($this->dataStatistics->supported()) {
         return $this->dataStatistics->get(self::CACHE_NAMESPACE . $evt->hash, 0);
     }
     // when APC is not supported, return approx. value
     return count($this->findByHash($evt->hash));
 }
Exemple #2
0
 public function supported()
 {
     if (self::$supported === null) {
         self::$supported = extension_loaded('apc') && ini_get('apc.enabled') && class_exists('APCIterator', false);
     }
     return self::$supported;
 }
    /**
     * Delete variable from the cache
     *
     * @param string $key Used to store the value.
     * @return void
     */
    function delete($key)
    {
        $_key = md5(_XE_PATH_ . $key);
        return apc_delete($_key);
    }
    /**
     * Truncate all existing variables at the cache
     *
     * @return bool Returns true on success or false on failure.
     */
    function truncate()
    {
        return apc_clear_cache('user');
    }
    /**
     * @DEPRECATED
     */
    function _delete($key)
    {
        return $this->delete($key);
    }
}
CacheApc::$isSupport = function_exists('apc_add');
/* End of file CacheApc.class.php */
/* Location: ./classes/cache/CacheApc.class.php */
 /**
  * Ustawienie prefixu na nazwy klucza
  * @param string $prefix
  */
 public static function sSetPrefix($prefix)
 {
     self::$sCachePrefix = $prefix;
 }