コード例 #1
0
 /**
  * Load the Cache with the parameters found in application.ini
  * 
  * Returns true if the cache can be used, false on fail
  * 
  * @static
  * @access private
  * @return bool
  */
 private static function _loadCache()
 {
     $configuration = Zend_Registry::get('configuration');
     $lifetime = $configuration->cache->lifetime;
     // only disable automatic serialization if you know what you're doing
     $frontendOptions = array('lifetime' => $lifetime ? $lifetime : 0, 'caching' => $configuration->cache->enable, 'cache_id_prefix' => $configuration->cache->namespace . '_', 'automatic_serialization' => true);
     // making sure it's lowercase
     $backendName = strtolower($configuration->cache->factory);
     $backendOptions = array();
     if (!self::_isExtensionLoaded($backendName)) {
         self::$_isLoaded = false;
         return false;
     }
     //
     if (null !== $configuration->cache->{$backendName}) {
         foreach ($configuration->cache->{$backendName} as $key => $value) {
             $backendOptions[$key] = $value;
         }
     }
     self::$_cache = Zend_Cache::factory('Core', $backendName, $frontendOptions, $backendOptions);
     self::$_isLoaded = true;
     return true;
 }