Beispiel #1
0
 public static function initialise(array $options = null)
 {
     self::$_cache = null;
     if (!$options) {
         $config = Zend_Registry::get('config')->cache;
         if ($config) {
             $options = $config->toArray();
         }
     }
     if (array_key_exists('frontend', $options)) {
         self::$_frontend = $options['frontend']['type'];
         if (array_key_exists('options', $options['frontend'])) {
             self::$_frontendOptions = $options['frontend']['options'];
         }
     }
     if (array_key_exists('backend', $options)) {
         self::$_backend = $options['backend']['type'];
         if (array_key_exists('options', $options['backend'])) {
             self::$_backendOptions = $options['backend']['options'];
         }
     }
     // Get the cache object.
     require_once 'Zend/Cache.php';
     // Workaround for Zend Bug ZF-10189
     require_once 'Zend/Log.php';
     self::$_cache = Zend_Cache::factory(self::$_frontend, self::$_backend, self::$_frontendOptions, self::$_backendOptions);
     self::$_enabled = true;
 }
Beispiel #2
0
 /**
  * Store cache
  *
  * @return void
  */
 public function dispatchLoopShutdown()
 {
     if (self::$_disableCache || $this->getResponse()->isRedirect() || null === $this->_key) {
         // We can't or don't want to cache this page.
         return;
     }
     // Cache this page.
     Zrt_Cache::save($this->getResponse(), $this->_key);
 }