예제 #1
0
 /**
  * Constructs this backend
  *
  * @param string $context FLOW3's application context
  * @param array $options Configuration options
  * @throws \TYPO3\CMS\Core\Cache\Exception If wincache PHP extension is not loaded
  */
 public function __construct($context, array $options = array())
 {
     if (!extension_loaded('wincache')) {
         throw new \TYPO3\CMS\Core\Cache\Exception('The PHP extension "wincache" must be installed and loaded in order to use the wincache backend.', 1343331520);
     }
     parent::__construct($context, $options);
 }
예제 #2
0
 /**
  * Set cache frontend instance and calculate data and tags table name
  *
  * @param \TYPO3\CMS\Core\Cache\Frontend\FrontendInterface $cache The frontend for this backend
  * @return void
  * @api
  */
 public function setCache(\TYPO3\CMS\Core\Cache\Frontend\FrontendInterface $cache)
 {
     parent::setCache($cache);
     $this->cacheTable = 'cf_' . $this->cacheIdentifier;
     $this->tagsTable = 'cf_' . $this->cacheIdentifier . '_tags';
     $this->initializeCommonReferences();
 }
예제 #3
0
 /**
  * Constructs this backend
  *
  * @param string $context FLOW3's application context
  * @param array $options Configuration options
  * @throws \TYPO3\CMS\Core\Cache\Exception If xcache PHP extension is not loaded
  */
 public function __construct($context, array $options = array())
 {
     if (!extension_loaded('xcache')) {
         throw new Exception('The PHP extension "xcache" must be installed and loaded in order to use the xcache backend.', 1363116592);
     }
     parent::__construct($context, $options);
 }
예제 #4
0
 /**
  * Set cache frontend instance and calculate data and tags table name
  *
  * @param FrontendInterface $cache The frontend for this backend
  * @return void
  * @api
  */
 public function setCache(FrontendInterface $cache)
 {
     parent::setCache($cache);
     $this->cacheTable = 'cf_' . $this->cacheIdentifier;
     $this->tagsTable = 'cf_' . $this->cacheIdentifier . '_tags';
     $this->maximumLifetime = self::FAKED_UNLIMITED_EXPIRE - $GLOBALS['EXEC_TIME'];
 }
예제 #5
0
 /**
  * Initializes the identifier prefix when setting the cache.
  *
  * @param \TYPO3\CMS\Core\Cache\Frontend\FrontendInterface $cache
  * @return void
  */
 public function setCache(\TYPO3\CMS\Core\Cache\Frontend\FrontendInterface $cache)
 {
     parent::setCache($cache);
     $processUser = extension_loaded('posix') ? posix_getpwuid(posix_geteuid()) : array('name' => 'default');
     $pathHash = \TYPO3\CMS\Core\Utility\GeneralUtility::shortMD5(PATH_site . $processUser['name'] . $this->context, 12);
     $this->identifierPrefix = 'TYPO3_' . $pathHash;
 }
 /**
  * @param array $pageHashs
  */
 protected function flushCacheByHashIdentifiersImplementation(&$pageHashs)
 {
     if (is_array($pageHashs) && count($pageHashs)) {
         foreach ($pageHashs as $pageHash) {
             if (substr($pageHash, 0, 3) == 'id-') {
                 $pageId = substr($pageHash, 3);
                 $this->pageCache->flushByTag('pageId_' . $pageId);
                 if ($this->ncStaticFileCache) {
                     $params = array('cacheCmd' => $pageId);
                     $this->ncStaticFileCache->clearStaticFile($params);
                 }
             } elseif (substr($pageHash, 0, 5) == 'hash-') {
                 $identifier = substr($pageHash, 5);
                 $this->pageCache->remove($identifier);
                 if ($this->ncStaticFileCache) {
                     $this->ncStaticFileCache->deleteStaticCacheByIdentifier($identifier);
                 }
             }
         }
     }
     $pageHashs = array();
 }
예제 #7
0
 /**
  * Sets a reference to the cache frontend which uses this backend and
  * initializes the default cache directory.
  *
  * TYPO3 v4 note: This method is different between TYPO3 v4 and FLOW3
  * because the Environment class to get the path to a temporary directory
  * does not exist in v4.
  *
  * @param \TYPO3\CMS\Core\Cache\Frontend\FrontendInterface $cache The cache frontend
  * @throws \TYPO3\CMS\Core\Cache\Exception
  * @return void
  */
 public function setCache(\TYPO3\CMS\Core\Cache\Frontend\FrontendInterface $cache)
 {
     parent::setCache($cache);
     if (empty($this->temporaryCacheDirectory)) {
         // If no cache directory was given with cacheDirectory
         // configuration option, set it to a path below typo3temp/
         $temporaryCacheDirectory = PATH_site . 'typo3temp/';
     } else {
         $temporaryCacheDirectory = $this->temporaryCacheDirectory;
     }
     $codeOrData = $cache instanceof \TYPO3\CMS\Core\Cache\Frontend\PhpFrontend ? 'Code' : 'Data';
     $finalCacheDirectory = $temporaryCacheDirectory . 'Cache/' . $codeOrData . '/' . $this->cacheIdentifier . '/';
     if (!is_dir($finalCacheDirectory)) {
         $this->createFinalCacheDirectory($finalCacheDirectory);
     }
     unset($this->temporaryCacheDirectory);
     $this->cacheDirectory = $finalCacheDirectory;
     $this->cacheEntryFileExtension = $cache instanceof \TYPO3\CMS\Core\Cache\Frontend\PhpFrontend ? '.php' : '';
     if (strlen($this->cacheDirectory) + 23 > \TYPO3\CMS\Core\Utility\GeneralUtility::getMaximumPathLength()) {
         throw new \TYPO3\CMS\Core\Cache\Exception('The length of the temporary cache file path "' . $this->cacheDirectory . '" exceeds the ' . 'maximum path length of ' . (\TYPO3\CMS\Core\Utility\GeneralUtility::getMaximumPathLength() - 23) . '. Please consider ' . 'setting the temporaryDirectoryBase option to a shorter path.', 1248710426);
     }
 }
 /**
  * Clears cache content for a list of page ids
  *
  * @param string $pidList A list of INTEGER numbers which points to page uids for which to clear entries in the cache_pages cache (page content cache)
  * @return void
  * @todo Define visibility
  */
 public function clearPageCacheContent_pidList($pidList)
 {
     $pageIds = GeneralUtility::trimExplode(',', $pidList);
     foreach ($pageIds as $pageId) {
         $this->pageCache->flushByTag('pageId_' . (int) $pageId);
     }
 }
예제 #9
0
 /**
  * Initializes the identifier prefix when setting the cache.
  *
  * @param \TYPO3\CMS\Core\Cache\Frontend\FrontendInterface $cache The frontend for this backend
  * @return void
  */
 public function setCache(\TYPO3\CMS\Core\Cache\Frontend\FrontendInterface $cache)
 {
     parent::setCache($cache);
     $identifierHash = substr(md5(PATH_site . $this->context . $this->cacheIdentifier), 0, 12);
     $this->identifierPrefix = 'TYPO3_' . $identifierHash . '_';
 }
예제 #10
0
 /**
  * Does garbage collection
  *
  * @return void
  * @api
  */
 public function collectGarbage()
 {
     $this->backend->collectGarbage();
 }
 /**
  * Construct this backend
  */
 public function __construct()
 {
     parent::__construct('production', array());
 }
예제 #12
0
 /**
  * Construct this backend
  *
  * @param string $context FLOW3's application context
  * @param array $options Configuration options
  * @throws \TYPO3\CMS\Core\Cache\Exception if php redis module is not loaded
  */
 public function __construct($context, array $options = array())
 {
     if (!extension_loaded('redis')) {
         throw new \TYPO3\CMS\Core\Cache\Exception('The PHP extension "redis" must be installed and loaded in order to use the redis backend.', 1279462933);
     }
     parent::__construct($context, $options);
 }
예제 #13
0
 /**
  * Initializes the identifier prefix when setting the cache.
  *
  * @param \TYPO3\CMS\Core\Cache\Frontend\FrontendInterface $cache
  * @return void
  */
 public function setCache(\TYPO3\CMS\Core\Cache\Frontend\FrontendInterface $cache)
 {
     parent::setCache($cache);
     $processUser = $this->getCurrentUserData();
     $pathHash = \TYPO3\CMS\Core\Utility\GeneralUtility::shortMD5($this->getPathSite() . $processUser['name'] . $this->context . $cache->getIdentifier(), 12);
     $this->setIdentifierPrefix('TYPO3_' . $pathHash);
 }
예제 #14
0
 /**
  * Initializes the identifier prefix when setting the cache.
  *
  * @param \TYPO3\CMS\Core\Cache\Frontend\FrontendInterface $cache The frontend for this backend
  * @return void
  */
 public function setCache(\TYPO3\CMS\Core\Cache\Frontend\FrontendInterface $cache)
 {
     parent::setCache($cache);
     $this->identifierPrefix = 'TYPO3_' . md5(PATH_site) . '_';
 }