public function __construct($prefix, CacheHandler $proxiedHandler, $allowCopyInLocalCache) {
        parent::__construct($prefix);

        $this->proxiedHandler = $proxiedHandler;

        if ($allowCopyInLocalCache) {
            $this->localHandler = new InMemoryCacheHandler();
        }
    }
Exemplo n.º 2
0
 public function __construct()
 {
     parent::__construct();
     $this->handlerConfigurations = module_invoke_all('dc_cache');
     // preparing default value for cache entry expiration time
     $cacheConfigurationSection = Environment::getInstance()->getConfigurationSection('Cache');
     if (isset($cacheConfigurationSection['Entry Expiration']['Default'])) {
         AbstractCacheHandler::$DEFAULT__ENTRY_EXPIRATION = $cacheConfigurationSection['Entry Expiration']['Default'];
     }
 }
 public function setValues($values, $expiration = NULL)
 {
     $timeStart = microtime(TRUE);
     $errorEntryNames = parent::setValues($values, $expiration);
     $entryCount = count($values);
     $errorEntryCount = count($errorEntryNames);
     $successfulEntryCount = $entryCount - $errorEntryCount;
     LogHelper::log_info(t("[@cacheType] Execution time for @successFlag storing of @entryCount entries is !executionTime", array('@cacheType' => $this->getCacheType(), '@entryCount' => $errorEntryCount == 0 ? $entryCount : ($successfulEntryCount == 0 ? $entryCount : "{$successfulEntryCount} out of {$entryCount}"), '!executionTime' => ExecutionPerformanceHelper::formatExecutionTime($timeStart), '@successFlag' => $errorEntryCount == 0 ? 'SUCCESSFUL' : ($successfulEntryCount == 0 ? 'UNSUCCESSFUL' : 'successful'))));
     // some errors but also some success
     return $errorEntryNames;
 }
    public function flush($subsetName = NULL) {
        $timeStart = microtime(TRUE);

        $result = parent::flush($subsetName);

        LogHelper::log_info(t(
            "[@cacheType] Execution time for@successFlag cache flush time is !executionTime",
            array(
                '@cacheType' => $this->getCacheType(),
                '!executionTime' => LogHelper::formatExecutionTime($timeStart),
                '@successFlag' => t(($result === FALSE) ? (' ' . t('UNSUCCESSFUL')) : ''))));

        return $result;
    }