/**
  * Initialize cache
  *
  * @return void
  */
 protected function initializeCache()
 {
     $this->cacheManager = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Cache\\CacheManager');
     try {
         $this->frontend = $this->cacheManager->getCache('cartography_cache');
     } catch (NoSuchCacheException $e) {
     }
 }
 /**
  * Initializes the cache for this command.
  *
  * @return void
  */
 protected function initializeCache()
 {
     try {
         $this->cacheInstance = $this->cacheManager->getCache('tx_solr');
     } catch (NoSuchCacheException $e) {
         $this->cacheInstance = $this->cacheFactory->create('tx_solr', $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['tx_solr']['frontend'], $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['tx_solr']['backend'], $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['tx_solr']['options']);
     }
 }
Beispiel #3
0
 /**
  *
  */
 public function initializeObject()
 {
     try {
         $this->cacheInstance = $this->cacheManager->getCache(self::CACHE_NAME);
     } catch (NoSuchCacheException $e) {
         $this->cacheInstance = $this->cacheFactory->create(self::CACHE_NAME, $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['typo3forum_main']['frontend'], $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['typo3forum_main']['backend'], $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['typo3forum_main']['options']);
     }
 }
Beispiel #4
0
 /**
  * Returns the cache object
  * @return mixed
  * @throws \Exception
  */
 protected function getCache()
 {
     try {
         $cache = $this->cacheManager->getCache('cicbase_cache');
     } catch (\TYPO3\CMS\Core\Cache\Exception\NoSuchCacheException $e) {
         throw new \Exception('Unable to load the cicbase cache.');
     }
     return $cache;
 }
 /**
  * Returns a cache instance.
  *
  * @param  string $name Name of the cache. Must be one of the class' constants.
  * @return FrontendInterface
  */
 public static function getCacheInstance($name)
 {
     if (!self::$cacheManager) {
         self::$cacheManager = Core::getObjectManager()->get(TYPO3CacheManager::class);
     }
     $cacheInstance = null;
     switch ($name) {
         case self::CACHE_MAIN:
         case self::CACHE_PROCESSED:
             $cacheInstance = self::$cacheManager->getCache($name);
     }
     return $cacheInstance;
 }
Beispiel #6
0
 /**
  * Clears the page cache
  *
  * @param mixed $pageIdsToClear (int) single or (array) multiple pageIds to clear the cache for
  * @return void
  */
 public function clearPageCache($pageIdsToClear = null)
 {
     if ($pageIdsToClear === null) {
         $this->cacheManager->flushCachesInGroup('pages');
     } else {
         if (!is_array($pageIdsToClear)) {
             $pageIdsToClear = array((int) $pageIdsToClear);
         }
         foreach ($pageIdsToClear as $pageId) {
             $this->cacheManager->flushCachesInGroupByTag('pages', 'pageId_' . $pageId);
         }
     }
 }
 /**
  * Flush menu cache for pages that were automatically published
  * between two runs of this command
  *
  * @return void
  */
 public function clearMenuForPulishedPagesCommand()
 {
     $current = time();
     $last = $this->registry->get('tx_autoflush', self::REGISTRY_KEY, $current);
     $pages = $this->findPagesPublishedBetween($last, $current);
     $pids = array();
     if ($pages) {
         foreach ($pages as $page) {
             $pids[$page['pid']] = $page['pid'];
         }
     }
     foreach ($pids as $pid) {
         $this->cacheManager->flushCachesInGroupByTag('pages', 'menu_pid_' . $pid);
     }
     $this->registry->set('tx_autoflush', self::REGISTRY_KEY, $current);
 }
 /**
  * Get schema SQL of required cache framework tables.
  *
  * This method needs ext_localconf and ext_tables loaded!
  *
  * @return string Cache framework SQL
  */
 public function getCachingFrameworkRequiredDatabaseSchema()
 {
     // Use new to circumvent the singleton pattern of CacheManager
     $cacheManager = new CacheManager();
     $cacheManager->setCacheConfigurations($GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']);
     // Cache manager needs cache factory. cache factory injects itself to manager in __construct()
     new CacheFactory('production', $cacheManager);
     $tableDefinitions = '';
     foreach ($GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations'] as $cacheName => $_) {
         $backend = $cacheManager->getCache($cacheName)->getBackend();
         if (method_exists($backend, 'getTableDefinitions')) {
             $tableDefinitions .= LF . $backend->getTableDefinitions();
         }
     }
     return $tableDefinitions;
 }
 /**
  * @return NULL
  */
 public function writeCachedConfigurationIfMissing()
 {
     /** @var StringFrontend $cache */
     $cache = $this->manager->getCache('fluidcontent');
     $hasCache = $cache->has('pageTsConfig');
     if (TRUE === $hasCache) {
         return;
     }
     $templates = $this->getAllRootTypoScriptTemplates();
     $paths = $this->getPathConfigurationsFromRootTypoScriptTemplates($templates);
     $pageTsConfig = '';
     $this->backupPageUidForConfigurationManager();
     foreach ($paths as $pageUid => $collection) {
         if (FALSE === $collection) {
             continue;
         }
         try {
             $this->overrideCurrentPageUidForConfigurationManager($pageUid);
             $wizardTabs = $this->buildAllWizardTabGroups($collection);
             $collectionPageTsConfig = $this->buildAllWizardTabsPageTsConfig($wizardTabs);
             $pageTsConfig .= '[PIDinRootline = ' . strval($pageUid) . ']' . LF;
             $pageTsConfig .= $collectionPageTsConfig . LF;
             $pageTsConfig .= '[GLOBAL]' . LF;
             $this->message('Built content setup for page ' . $pageUid, GeneralUtility::SYSLOG_SEVERITY_INFO, 'Fluidcontent');
         } catch (\Exception $error) {
             $this->debug($error);
         }
     }
     $this->restorePageUidForConfigurationManager();
     $cache->set('pageTsConfig', $pageTsConfig, array(), 806400);
     return NULL;
 }
Beispiel #10
0
 /**
  * Initializes the Reflection Service
  *
  * @return void
  * @see initialize()
  */
 protected function initializeReflection()
 {
     $this->reflectionService = $this->objectManager->get('TYPO3\\CMS\\Extbase\\Reflection\\ReflectionService');
     $this->reflectionService->setDataCache($this->cacheManager->getCache('extbase_reflection'));
     if (!$this->reflectionService->isInitialized()) {
         $this->reflectionService->initialize();
     }
 }
 /**
  * @param string $classFile
  * @param string $className
  * @param bool $triggerRequire
  */
 protected function writeCacheEntryForClass($className, $classFile, $triggerRequire = FALSE)
 {
     $classesCache = $this->cacheManager->getCache('cache_classes');
     $cacheEntryIdentifier = strtolower(str_replace('\\', '_', $className));
     $classLoadingInformation = array($classFile, strtolower($className));
     if (!$classesCache->has($cacheEntryIdentifier)) {
         $classesCache->set($cacheEntryIdentifier, implode("ÿ", $classLoadingInformation));
     }
 }
 /**
  * @return void
  */
 public function writeCachedConfigurationIfMissing()
 {
     /** @var StringFrontend $cache */
     $cache = $this->manager->getCache('fluidcontent');
     $hasCache = $cache->has('pageTsConfig');
     if (FALSE === $hasCache) {
         $cache->set('pageTsConfig', $this->getPageTsConfig(), array(), 86400);
     }
 }
Beispiel #13
0
 /**
  * Get the cache to retrieve labels.
  *
  * @return \TYPO3\CMS\Core\Cache\Cache
  */
 private function getCache()
 {
     if ($this->cache === null) {
         try {
             $this->cache = $this->cacheManager->getCache('tev_label_label_cache');
         } catch (NoSuchCacheException $e) {
             $this->cache = $this->cacheFactory->create('tev_label_label_cache', $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['tev_label_label_cache']['frontend'], $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['tev_label_label_cache']['backend'], $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['tev_label_label_cache']['options']);
         }
     }
     return $this->cache;
 }
Beispiel #14
0
 /**
  * Initializes this object. This is called by the storage after the driver
  * has been attached.
  *
  * @return void
  */
 public function initialize()
 {
     $this->objectManager = GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
     $this->cacheManager = $this->objectManager->get('TYPO3\\CMS\\Core\\Cache\\CacheManager');
     $this->cache = $this->cacheManager->getCache('fal_dropbox');
     if (!empty($this->configuration['accessToken'])) {
         $this->dropboxClient = $this->objectManager->get('SFroemken\\FalDropbox\\Dropbox\\Client', $this->configuration['accessToken'], 'TYPO3 CMS');
     } else {
         $this->dropboxClient = NULL;
     }
 }
 /**
  * @test
  */
 public function clearsCachesOfDuplicateRegisteredPageIdsOnlyOnce()
 {
     $this->cacheManagerMock->expects($this->at(0))->method('flushCachesInGroupByTag')->with('pages', 'pageId_2');
     $this->cacheManagerMock->expects($this->at(1))->method('flushCachesInGroupByTag')->with('pages', 'pageId_15');
     $this->cacheManagerMock->expects($this->at(2))->method('flushCachesInGroupByTag')->with('pages', 'pageId_8');
     $this->cacheManagerMock->expects($this->exactly(3))->method('flushCachesInGroupByTag');
     $this->cacheService->getPageIdStack()->push(8);
     $this->cacheService->getPageIdStack()->push(15);
     $this->cacheService->getPageIdStack()->push(15);
     $this->cacheService->getPageIdStack()->push(2);
     $this->cacheService->getPageIdStack()->push(2);
     $this->cacheService->clearCachesOfRegisteredPageIds();
 }
 /**
  * @return void
  */
 protected function initializeExtbaseFramework()
 {
     // initialize cache manager
     $this->cacheManager = $GLOBALS['typo3CacheManager'];
     // inject content object into the configuration manager
     $this->configurationManager = $this->objectManager->get('TYPO3\\CMS\\Extbase\\Configuration\\ConfigurationManagerInterface');
     $contentObject = GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectRenderer');
     $this->configurationManager->setContentObject($contentObject);
     $this->typoScriptService->makeTypoScriptBackup();
     // load extbase typoscript
     TypoScriptService::loadTypoScriptFromFile('EXT:extbase/ext_typoscript_setup.txt');
     TypoScriptService::loadTypoScriptFromFile('EXT:ap_ldap_auth/ext_typoscript_setup.txt');
     $this->configurationManager->setConfiguration($GLOBALS['TSFE']->tmpl->setup);
     $this->configureObjectManager();
     // initialize reflection
     $this->reflectionService = $this->objectManager->get('TYPO3\\CMS\\Extbase\\Reflection\\ReflectionService');
     $this->reflectionService->setDataCache($this->cacheManager->getCache('extbase_reflection'));
     if (!$this->reflectionService->isInitialized()) {
         $this->reflectionService->initialize();
     }
     // initialize persistence
     $this->persistenceManager = $this->objectManager->get('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\PersistenceManager');
 }
 /**
  * @return void
  */
 public function writeCachedConfigurationIfMissing()
 {
     /** @var StringFrontend $cache */
     $cache = $this->manager->getCache('fluidcontent');
     $hasCache = $cache->has('pageTsConfig');
     if (FALSE === $hasCache) {
         $pageTsConfig = '';
         $templates = $this->getAllRootTypoScriptTemplates();
         foreach ($templates as $template) {
             $pageUid = (int) $template['pid'];
             $pageTsConfig .= $this->renderPageTypoScriptForPageUid($pageUid);
         }
         $cache->set('pageTsConfig', $pageTsConfig, array(), 86400);
     }
 }
Beispiel #18
0
 /**
  * Factory method which creates the specified cache along with the specified kind of backend.
  * After creating the cache, it will be registered at the cache manager.
  *
  * @param string $cacheIdentifier The name / identifier of the cache to create
  * @param string $cacheObjectName Object name of the cache frontend
  * @param string $backendObjectName Object name of the cache backend
  * @param array $backendOptions (optional) Array of backend options
  * @return \TYPO3\CMS\Core\Cache\Frontend\FrontendInterface The created cache frontend
  * @throws \TYPO3\CMS\Core\Cache\Exception\InvalidBackendException if the cache backend is not valid
  * @throws \TYPO3\CMS\Core\Cache\Exception\InvalidCacheException if the cache frontend is not valid
  * @api
  */
 public function create($cacheIdentifier, $cacheObjectName, $backendObjectName, array $backendOptions = array())
 {
     // New operator used on purpose: This class is required early during
     // bootstrap before makeInstance() is propely set up
     $backendObjectName = '\\' . ltrim($backendObjectName, '\\');
     $backend = new $backendObjectName($this->context, $backendOptions);
     if (!$backend instanceof \TYPO3\CMS\Core\Cache\Backend\BackendInterface) {
         throw new \TYPO3\CMS\Core\Cache\Exception\InvalidBackendException('"' . $backendObjectName . '" is not a valid cache backend object.', 1216304301);
     }
     if (is_callable(array($backend, 'initializeObject'))) {
         $backend->initializeObject();
     }
     // New used on purpose, see comment above
     $cache = new $cacheObjectName($cacheIdentifier, $backend);
     if (!$cache instanceof \TYPO3\CMS\Core\Cache\Frontend\FrontendInterface) {
         throw new \TYPO3\CMS\Core\Cache\Exception\InvalidCacheException('"' . $cacheObjectName . '" is not a valid cache frontend object.', 1216304300);
     }
     if (is_callable(array($cache, 'initializeObject'))) {
         $cache->initializeObject();
     }
     $this->cacheManager->registerCache($cache);
     return $cache;
 }
Beispiel #19
0
 /**
  * Wrapper function for unloading extensions
  *
  * @param string $extensionKey
  * @return void
  */
 protected function unloadExtension($extensionKey)
 {
     $this->packageManager->deactivatePackage($extensionKey);
     $this->cacheManager->flushCachesInGroup('system');
 }
Beispiel #20
0
 /**
  * @param ConsoleBootstrap $bootstrap
  */
 public static function initializeCachingFramework(ConsoleBootstrap $bootstrap)
 {
     // Cache framework initialisation for TYPO3 CMS <= 7.3
     if (class_exists('TYPO3\\CMS\\Core\\Cache\\Cache')) {
         $bootstrap->setEarlyInstance('TYPO3\\CMS\\Core\\Cache\\CacheManager', \TYPO3\CMS\Core\Cache\Cache::initializeCachingFramework());
         // @deprecated since 6.2 will be removed in two versions
         if (class_exists('TYPO3\\CMS\\Core\\Compatibility\\GlobalObjectDeprecationDecorator')) {
             $GLOBALS['typo3CacheManager'] = new \TYPO3\CMS\Core\Compatibility\GlobalObjectDeprecationDecorator('TYPO3\\CMS\\Core\\Cache\\CacheManager');
             $GLOBALS['typo3CacheFactory'] = new \TYPO3\CMS\Core\Compatibility\GlobalObjectDeprecationDecorator('TYPO3\\CMS\\Core\\Cache\\CacheFactory');
         }
     } else {
         $cacheManager = new \TYPO3\CMS\Core\Cache\CacheManager();
         $cacheManager->setCacheConfigurations($GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']);
         \TYPO3\CMS\Core\Utility\GeneralUtility::setSingletonInstance(\TYPO3\CMS\Core\Cache\CacheManager::class, $cacheManager);
         $cacheFactory = new \TYPO3\CMS\Core\Cache\CacheFactory('production', $cacheManager);
         \TYPO3\CMS\Core\Utility\GeneralUtility::setSingletonInstance(\TYPO3\CMS\Core\Cache\CacheFactory::class, $cacheFactory);
         $bootstrap->setEarlyInstance(\TYPO3\CMS\Core\Cache\CacheManager::class, $cacheManager);
     }
 }
 /**
  * Sets up this test case
  *
  * @return void
  */
 protected function setUp()
 {
     $this->singletonInstances = GeneralUtility::getSingletonInstances();
     $this->view = $this->getAccessibleMock(\TYPO3\CMS\Fluid\View\StandaloneView::class, array('testFileExistence', 'buildParserConfiguration', 'getOrParseAndStoreTemplate'), array(), '', false);
     $this->mockConfigurationManager = $this->getMock(ConfigurationManagerInterface::class);
     $this->mockObjectManager = $this->getMock(\TYPO3\CMS\Extbase\Object\ObjectManager::class);
     $this->mockObjectManager->expects($this->any())->method('get')->will($this->returnCallback(array($this, 'objectManagerCallback')));
     $this->mockRequest = $this->getMock(Request::class);
     $this->mockUriBuilder = $this->getMock(UriBuilder::class);
     $this->mockContentObject = $this->getMock(\TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::class);
     $this->mockControllerContext = $this->getMock(ControllerContext::class);
     $this->mockControllerContext->expects($this->any())->method('getRequest')->will($this->returnValue($this->mockRequest));
     $this->mockTemplatePaths = $this->getMock(TemplatePaths::class);
     $this->mockViewHelperVariableContainer = $this->getMock(ViewHelperVariableContainer::class);
     $this->mockRenderingContext = $this->getMock(\TYPO3\CMS\Fluid\Tests\Unit\Core\Rendering\RenderingContextFixture::class);
     $this->mockRenderingContext->expects($this->any())->method('getControllerContext')->will($this->returnValue($this->mockControllerContext));
     $this->mockRenderingContext->expects($this->any())->method('getViewHelperVariableContainer')->will($this->returnValue($this->mockViewHelperVariableContainer));
     $this->mockRenderingContext->expects($this->any())->method('getVariableProvider')->willReturn($this->mockVariableProvider);
     $this->mockRenderingContext->expects($this->any())->method('getTemplatePaths')->willReturn($this->mockTemplatePaths);
     $this->view->_set('objectManager', $this->mockObjectManager);
     $this->view->_set('baseRenderingContext', $this->mockRenderingContext);
     $this->view->_set('controllerContext', $this->mockControllerContext);
     $this->view->expects($this->any())->method('getOrParseAndStoreTemplate')->willReturn($this->mockParsedTemplate);
     GeneralUtility::setSingletonInstance(\TYPO3\CMS\Extbase\Object\ObjectManager::class, $this->mockObjectManager);
     GeneralUtility::addInstance(\TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::class, $this->mockContentObject);
     $this->mockCacheManager = $this->getMock(\TYPO3\CMS\Core\Cache\CacheManager::class, array(), array(), '', false);
     $mockCache = $this->getMock(\TYPO3Fluid\Fluid\Core\Cache\FluidCacheInterface::class, array(), array(), '', false);
     $this->mockCacheManager->expects($this->any())->method('getCache')->will($this->returnValue($mockCache));
     GeneralUtility::setSingletonInstance(\TYPO3\CMS\Core\Cache\CacheManager::class, $this->mockCacheManager);
 }
Beispiel #22
0
 /**
  * Lifecycle method
  *
  * @return void
  */
 public function initializeObject()
 {
     $this->tableColumnCache = $this->cacheManager->getCache('extbase_typo3dbbackend_tablecolumns');
     $this->queryCache = $this->cacheManager->getCache('extbase_typo3dbbackend_queries');
 }
Beispiel #23
0
 /**
  * Flush cache
  *
  * @return void
  */
 public function flush()
 {
     $this->cacheManager->getCache($this->cacheName)->flush();
 }
 /**
  * @test
  */
 public function getClassTagRendersTagWhichCanBeUsedToTagACacheEntryWithACertainClass()
 {
     $identifier = 'someCacheIdentifier';
     $backend = $this->getMock('TYPO3\\CMS\\Core\\Cache\\Backend\\AbstractBackend', array('get', 'set', 'has', 'remove', 'findIdentifiersByTag', 'flush', 'flushByTag', 'collectGarbage'), array(), '', FALSE);
     $cache = $this->getMock('TYPO3\\CMS\\Core\\Cache\\Frontend\\StringFrontend', array('__construct', 'get', 'set', 'has', 'remove', 'getByTag'), array($identifier, $backend));
     $this->assertEquals('%CLASS%F3_Foo_Bar_Baz', \TYPO3\CMS\Core\Cache\CacheManager::getClassTag('F3\\Foo\\Bar\\Baz'));
 }
Beispiel #25
0
 /**
  * A slot method to inject the required caching framework database tables to the
  * tables definitions string
  *
  * @param array $sqlString
  * @param string $extensionKey
  * @return array
  */
 public function addCachingFrameworkRequiredDatabaseSchemaToTablesDefinition(array $sqlString, $extensionKey)
 {
     self::$cacheManager->setCacheConfigurations($GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']);
     $sqlString[] = static::getDatabaseTableDefinitions();
     return array('sqlString' => $sqlString, 'extensionKey' => $extensionKey);
 }
 /**
  * Construct
  *
  * @param CacheManager $cacheManager Application CacheManager
  *
  * @throws \TYPO3\CMS\Core\Cache\Exception\NoSuchCacheException The application
  * caching framework will throw this exception if the specified cache isn't
  * properly configured.
  */
 public function __construct(CacheManager $cacheManager)
 {
     $this->cache = $cacheManager->getCache('cache_hash');
 }
 /**
  * @param CacheManager $cacheManager
  */
 public function __construct(CacheManager $cacheManager)
 {
     $this->cache = $cacheManager->getCache('codesnippet_brushes');
 }
 /**
  * @param \TYPO3\CMS\Core\Cache\CacheManager $cacheManager
  * @return void
  */
 public function injectCacheManager(\TYPO3\CMS\Core\Cache\CacheManager $cacheManager)
 {
     $this->tokenCache = $cacheManager->getCache('hairu_token');
 }
 /**
  * Initializes the cache and determines caching method.
  *
  * @author  Martin Helmich <*****@*****.**>
  * @version 2008-10-11
  * @param   string $mode The caching mode. This may either be 'auto',
  *                       'apc','database','file' or 'none' (see above).
  * @param array $configuration
  * @throws Exception
  */
 function init($mode = 'auto', $configuration = array())
 {
     /* If mode is set to 'auto' or 'apc', first try to set mode
      * to APC (if enabled) or otherwise to database. */
     if ($mode == 'auto' || $mode == 'apc') {
         if ($this->getAPCEnabled()) {
             $useMode = 'apc';
         } else {
             $useMode = 'database';
         }
         /* If mode is set to 'file',... */
     } elseif ($mode == 'file') {
         $useMode = 'file';
     } elseif ($mode == 'none') {
         $useMode = 'none';
     } else {
         $useMode = 'database';
     }
     /* Compose class name and instantiate */
     if (isset($GLOBALS['typo3CacheManager'])) {
         $this->useTYPO3Cache = TRUE;
         if ($useMode == 'database') {
             $this->cacheObj =& $this->typo3CacheManager->getCache('cache_hash');
         } else {
             if ($this->typo3CacheManager->hasCache('mm_forum')) {
                 $this->cacheObj =& $this->typo3CacheManager->getCache('mm_forum');
             } else {
                 switch ($useMode) {
                     case 'database':
                         $className = 't3lib_cache_backend_DbBackend';
                         break;
                     case 'apc':
                         $className = 't3lib_cache_backend_ApcBackend';
                         break;
                     case 'file':
                         $className = 't3lib_cache_backend_FileBackend';
                         break;
                     case 'none':
                         $className = 't3lib_cache_backend_NullBackend';
                         break;
                     case 'globals':
                         $className = 't3lib_cache_backend_GlobalsBackend';
                         break;
                     default:
                         throw new Exception("Unknown caching mode: {$useMode}", 1296594227);
                 }
                 if (!class_exists($className) && file_exists(PATH_t3lib . 'cache/backend/class.' . strtolower($className) . '.php')) {
                     include_once PATH_t3lib . 'cache/backend/class.' . strtolower($className) . '.php';
                 } elseif (!class_exists($className)) {
                     $this->cacheObj =& $this->typo3CacheManager->getCache('cache_hash');
                 }
                 if (class_exists($className)) {
                     $cacheBackend = GeneralUtility::makeInstance($className, $configuration);
                     $cacheObject = GeneralUtility::makeInstance('t3lib_cache_frontend_VariableFrontend', 'mm_forum', $cacheBackend);
                     $this->typo3CacheManager->registerCache($cacheObject);
                     $this->cacheObj =& $this->typo3CacheManager->getCache('mm_forum');
                 } else {
                     throw new Exception("Cache backend does not exist: {$className}", 1296594228);
                 }
             }
         }
     } else {
         $className = 'tx_mmforum_cache_' . $useMode;
         $this->cacheObj =& GeneralUtility::makeInstance($className);
     }
 }
 /**
  * @param CacheManager $cacheManager
  *
  * @throws \TYPO3\CMS\Core\Cache\Exception\NoSuchCacheException
  */
 public function injectCacheManager(CacheManager $cacheManager)
 {
     $this->cache = $cacheManager->getCache('codesnippet_brushes');
 }