Esempio n. 1
0
 function initCaching()
 {
     $lifetime = 0;
     if ($this->confArr['useInternalCaching']) {
         $cachingEngine = $this->confArr['cachingEngine'];
         if ($cachingEngine == 'cachingFramework') {
             if (!is_object($GLOBALS['typo3CacheFactory']) || !isset($GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['tt_news_cache']['backend'])) {
                 // if there's no cacheFactory object fall back to internal caching (TYPO3 < 4.3)
                 $cachingEngine = 'internal';
             }
         }
         if (!$cachingEngine) {
             $cachingEngine = 'internal';
         }
         $this->cache_amenuPeriods = true;
         $this->cache_categoryCount = true;
         $this->cache_categories = true;
         if ($this->confArr['writeCachingInfoToDevlog']) {
             $tmp = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode('|', $this->confArr['writeCachingInfoToDevlog'], 0);
             if ($tmp[1]) {
                 $this->writeCachingInfoToDevlog = $tmp[1];
             }
         }
         switch ($this->confArr['cacheClearMode']) {
             case 'lifetime':
                 $lifetime = $this->confArr['cacheLifetime'];
                 break;
             default:
                 // normal
                 if (method_exists($this->tsfe, 'get_cache_timeout')) {
                     // TYPO3 >= 4.2
                     $lifetime = $this->tsfe->get_cache_timeout();
                     // seconds until a cached page is too old
                 } else {
                     $lifetime = 86400;
                 }
                 break;
                 // the case 'never' uses the default: $lifetime = 0;
         }
         $this->cache = new tx_ttnews_cache($cachingEngine);
         $this->cache->lifetime = $lifetime;
         $this->cache->ACCESS_TIME = $this->SIM_ACCESS_TIME;
     }
 }