/** * Start caching with op cache, user cache and cloudrexx caching (cloudrexx caching in frontend only) * @param \Cx\Core\Core\Controller\Cx $cx The instance of \Cx\Core\Core\Controller\Cx */ public function preInit(\Cx\Core\Core\Controller\Cx $cx) { if ($this->cx->getMode() == \Cx\Core\Core\Controller\Cx::MODE_FRONTEND) { $this->cache = new \Cx\Core_Modules\Cache\Controller\Cache(); } else { // load CacheLib for other modes than frontend //- ATTENTION: never load CacheManager here, because it uses not yet defined constants which will cause a fatal error $this->cache = new \Cx\Core_Modules\Cache\Controller\CacheLib(); } $this->cacheDriver = $this->cache->getDoctrineCacheDriver(); if ($this->cx->getMode() == \Cx\Core\Core\Controller\Cx::MODE_FRONTEND) { $this->cache->deactivateNotUsedOpCaches(); } elseif (!isset($_GET['cmd']) || $_GET['cmd'] != 'settings') { $this->cache->deactivateNotUsedOpCaches(); } if ($this->cache->getUserCacheEngine() == \Cx\Core_Modules\Cache\Controller\Cache::CACHE_ENGINE_APC || $this->cache->getOpCacheEngine() == \Cx\Core_Modules\Cache\Controller\Cache::CACHE_ENGINE_APC) { // when using apc the memory limit can be reduced to 32M to save RAM $this->cx->setMemoryLimit(32); } // start cloudrexx caching if ($this->cx->getMode() != \Cx\Core\Core\Controller\Cx::MODE_FRONTEND) { return; } $this->cache->startContrexxCaching(); }