/**
  * create_cache_strategy_instance method
  *
  * Method to instantiate new cache strategy object
  *
  * @param string $cache_dirs Cache directory to use
  * @param array   $skip_small_bits Set to true, to ignore small entities
  *                                cache engines, as APC [optional=false]
  *
  * @return Ai1ec_Cache_Strategy Instantiated writer
  */
 public function create_cache_strategy_instance($cache_dirs = null, $skip_small_entities_cache = false)
 {
     $engine = null;
     $name = '';
     if (false === $skip_small_entities_cache && Ai1ec_Cache_Strategy_Apc::is_available()) {
         $engine = $this->_registry->get('cache.strategy.apc');
     } else {
         if (false === AI1EC_DISABLE_FILE_CACHE && null !== $cache_dirs && ($cache_dir = $this->_get_writable_cache_dir($cache_dirs))) {
             $engine = $this->_registry->get('cache.strategy.file', $cache_dir);
         } else {
             $engine = $this->_registry->get('cache.strategy.db', $this->_registry->get('model.option'));
         }
     }
     return $engine;
 }
Beispiel #2
0
 /**
  * create_cache_strategy_instance method
  *
  * Method to instantiate new cache strategy object
  *
  * @param string $cache_directory Cache directory to use
  * @param bool   $skip_small_bits Set to true, to ignore small entities
  *                                cache engines, as APC [optional=false]
  *
  * @return Ai1ec_Cache_Strategy Instantiated writer
  */
 public function create_cache_strategy_instance($cache_directory = NULL, $skip_small_bits = false)
 {
     $engine = NULL;
     $name = '';
     if (true !== $skip_small_bits && Ai1ec_Cache_Strategy_Apc::is_available()) {
         $engine = $this->_registry->get('cache.strategy.apc');
     } else {
         if (NULL !== $cache_directory && $this->_is_cache_dir_writable($cache_directory)) {
             $engine = $this->_registry->get('cache.strategy.file', $cache_directory);
         } else {
             if (true !== $skip_small_bits) {
                 $engine = $this->_registry->get('cache.strategy.db', $this->_registry->get('model.option'));
             } else {
                 $engine = $this->_registry->get('cache.strategy.void');
             }
         }
     }
     return $engine;
 }