Ejemplo n.º 1
0
 /**
  * Initialize the Cache Engine
  *
  * Called automatically by the cache frontend
  * To reinitialize the settings call Cache::engine('EngineName', [optional] settings = array());
  *
  * @param array $settings array of setting for the engine
  *
  * @return boolean True if the engine has been successfully initialized, false if not
  * @access   public
  */
 public function init($settings = array())
 {
     if (!class_exists('Memcache')) {
         return false;
     }
     parent::init($settings);
     $defaults = array('servers' => array('127.0.0.1'), 'compress' => false);
     $this->settings = array_merge($defaults, $this->settings);
     if (!$this->settings['compress']) {
         $this->settings['compress'] = MEMCACHE_COMPRESSED;
     }
     if (!is_array($this->settings['servers'])) {
         $this->settings['servers'] = array($this->settings['servers']);
     }
     $this->memcache = null;
     $this->memcache = new Memcache();
     foreach ($this->settings['servers'] as $server) {
         $parts = explode(':', $server);
         $host = $parts[0];
         $port = 11211;
         if (isset($parts[1])) {
             $port = $parts[1];
         }
         if ($this->memcache->addserver($host, $port)) {
             return true;
         }
     }
     return false;
 }
Ejemplo n.º 2
0
 /**
  * Initialize the Cache Engine
  *
  * Called automatically by the cache frontend
  * To reinitialize the settings call Cache::engine('EngineName', [optional] settings = array());
  *
  * @param array $settings array of setting for the engine
  * @return boolean True if the engine has been successfully initialized, false if not
  * @access   public
  */
 function init($settings)
 {
     parent::init($settings);
     $defaults = array('PHP_AUTH_USER' => 'cake', 'PHP_AUTH_PW' => 'cake');
     $this->settings = array_merge($defaults, $this->settings);
     return function_exists('xcache_info');
 }
Ejemplo n.º 3
0
 /**
  * Initialize the Cache Engine
  *
  * Called automatically by the cache frontend
  * To reinitialize the settings call Cache::engine('EngineName', [optional] settings = array());
  *
  * @param array $settings array of setting for the engine
  *
  * @return boolean True if the engine has been successfully initialized, false if not
  * @see      CacheEngine::__defaults
  * @access   public
  */
 function init($settings = array())
 {
     parent::init($settings);
     return function_exists('apc_cache_info');
 }
Ejemplo n.º 4
0
 /**
  * Initialize the Cache Engine
  *
  * Called automatically by the cache frontend
  * To reinitialize the settings call Cache::engine('EngineName', [optional] settings = array());
  *
  * @param array $setting array of setting for the engine
  * @return boolean True if the engine has been successfully initialized, false if not
  * @access public
  */
 function init($settings = array())
 {
     parent::init($settings);
     $defaults = array('path' => XOOPS_VAR_PATH . '/caches/xoops_cache', 'extension' => '.php', 'prefix' => 'xoops_', 'lock' => false, 'serialize' => false, 'duration' => 31556926);
     $this->settings = array_merge($defaults, $this->settings);
     if (!isset($this->file)) {
         XoopsLoad::load('XoopsFile');
         $this->file = XoopsFile::getHandler('file', $this->settings['path'] . '/index.html', true);
     }
     $this->settings['path'] = $this->file->folder->cd($this->settings['path']);
     if (empty($this->settings['path'])) {
         return false;
     }
     return $this->active();
 }
Ejemplo n.º 5
0
 /**
  * Initialize the Cache Engine
  *
  * Called automatically by the cache frontend
  * To reinitialize the settings call Cache::engine('EngineName', [optional] settings = array());
  *
  * @param  array $settings array of setting for the engine
  * @return boolean True if the engine has been successfully initialized, false if not
  * @access   public
  */
 public function init($settings)
 {
     $xoopsDB = XoopsDatabaseFactory::getDatabaseConnection();
     parent::init($settings);
     $defaults = array('fields' => array('data', 'expires'));
     $this->settings = array_merge($defaults, $this->settings);
     $this->fields = $this->settings['fields'];
     $this->model = new XoopsCacheModelHandler($xoopsDB);
     return true;
 }
Ejemplo n.º 6
0
 /**
  * Initialize the Cache Engine
  *
  * Called automatically by the cache frontend
  * To reinitialize the settings call Cache::engine('EngineName', [optional] settings = array());
  *
  * @param array $setting array of setting for the engine
  * @return boolean True if the engine has been successfully initialized, false if not
  * @access public
  */
 function init($settings)
 {
     parent::init($settings);
     $defaults = array('fields' => array('data', 'expires'));
     $this->settings = array_merge($defaults, $this->settings);
     $this->fields = $this->settings['fields'];
     $this->model = new XoopsCacheModelHandler($GLOBALS["xoopsDB"]);
     return true;
 }