Esempio n. 1
0
 /**
  * @deprecated Configuration should not be accessed by class, rather register a service with configuration
  *
  * @return stdClass
  * @throws CM_Exception_Invalid
  */
 protected static function _getConfig()
 {
     if (null === self::$_classConfigCacheEnabled) {
         self::$_classConfigCacheEnabled = CM_Config::get()->classConfigCacheEnabled;
     }
     $calledClass = get_called_class();
     $cacheKey = CM_CacheConst::ClassConfig . '_className:' . $calledClass;
     $cache = new CM_Cache_Storage_Apc();
     if (!self::$_classConfigCacheEnabled || !isset(self::$_classConfigList[$calledClass])) {
         if (!self::$_classConfigCacheEnabled || false === ($result = $cache->get($cacheKey))) {
             $result = self::_getConfigRaw();
             if (self::$_classConfigCacheEnabled) {
                 $cache->set($cacheKey, $result);
             }
         }
         self::$_classConfigList[$calledClass] = $result;
     }
     return self::$_classConfigList[$calledClass];
 }
Esempio n. 2
0
 /**
  * @return array
  */
 private function _getModulePaths()
 {
     $cacheKey = CM_CacheConst::Modules;
     $apcCache = new CM_Cache_Storage_Apc();
     if (false === ($modulePaths = $apcCache->get($cacheKey))) {
         $fileCache = new CM_Cache_Storage_File();
         $installation = new CM_App_Installation(DIR_ROOT);
         if ($installation->getUpdateStamp() > $fileCache->getCreateStamp($cacheKey) || false === ($modulePaths = $fileCache->get($cacheKey))) {
             $modulePaths = $installation->getModulePaths();
             $fileCache->set($cacheKey, $modulePaths);
         }
         $apcCache->set($cacheKey, $modulePaths);
     }
     return $modulePaths;
 }