Esempio n. 1
0
 /**
  * Sets a reference to the cache frontend which uses this backend and
  * initializes the default cache directory.
  *
  * @param \TYPO3\FLOW3\Cache\Frontend\FrontendInterface $cache The cache frontend
  * @return void
  * @throws \TYPO3\FLOW3\Cache\Exception
  */
 public function setCache(FrontendInterface $cache)
 {
     parent::setCache($cache);
     $codeOrData = $cache instanceof PhpFrontend ? 'Code' : 'Data';
     $cacheDirectory = $this->environment->getPathToTemporaryDirectory() . 'Cache/' . $codeOrData . '/' . $this->cacheIdentifier . '/';
     if (!is_writable($cacheDirectory)) {
         try {
             \TYPO3\FLOW3\Utility\Files::createDirectoryRecursively($cacheDirectory);
         } catch (\TYPO3\FLOW3\Utility\Exception $exception) {
             throw new \TYPO3\FLOW3\Cache\Exception('The cache directory "' . $cacheDirectory . '" could not be created.', 1264426237);
         }
     }
     if (!is_dir($cacheDirectory) && !is_link($cacheDirectory)) {
         throw new \TYPO3\FLOW3\Cache\Exception('The cache directory "' . $cacheDirectory . '" does not exist.', 1203965199);
     }
     if (!is_writable($cacheDirectory)) {
         throw new \TYPO3\FLOW3\Cache\Exception('The cache directory "' . $cacheDirectory . '" is not writable.', 1203965200);
     }
     $this->cacheDirectory = $cacheDirectory;
     $this->cacheEntryFileExtension = $cache instanceof PhpFrontend ? '.php' : '';
     if (strlen($this->cacheDirectory) + 23 > $this->environment->getMaximumPathLength()) {
         throw new \TYPO3\FLOW3\Cache\Exception('The length of the temporary cache path "' . $this->cacheDirectory . '" exceeds the maximum path length of ' . ($this->environment->getMaximumPathLength() - 23) . '. Please consider setting the temporaryDirectoryBase option to a shorter path. ', 1248710426);
     }
 }
Esempio n. 2
0
 /**
  * Does garbage collection
  *
  * @return void
  * @api
  */
 public function collectGarbage()
 {
     $this->backend->collectGarbage();
 }