/** * 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)); }
public function supported() { if (self::$supported === null) { self::$supported = extension_loaded('apc') && ini_get('apc.enabled') && class_exists('APCIterator', false); } return self::$supported; }