/** * 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 */ public function init($settings = array()) { if (!class_exists('Memcache')) { return false; } if (!isset($settings['prefix'])) { $settings['prefix'] = Inflector::slug(APP_DIR) . '_'; } $settings += array('engine' => 'Memcache', 'servers' => array('127.0.0.1'), 'compress' => false, 'persistent' => true); parent::init($settings); if ($this->settings['compress']) { $this->settings['compress'] = MEMCACHE_COMPRESSED; } if (is_string($this->settings['servers'])) { $this->settings['servers'] = array($this->settings['servers']); } if (!isset($this->_Memcache)) { $return = false; $this->_Memcache = new Memcache(); foreach ($this->settings['servers'] as $server) { list($host, $port) = $this->_parseServerString($server); if ($this->_Memcache->addServer($host, $port, $this->settings['persistent'])) { $return = true; } } return $return; } return true; }
/** * 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(array_merge(array( 'engine' => 'Xcache', 'prefix' => Inflector::slug(APP_DIR) . '_', 'PHP_AUTH_USER' => 'user', 'PHP_AUTH_PW' => 'password' ), $settings) ); return function_exists('xcache_info'); }
/** * 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()) { if (!class_exists('Memcache')) { return false; } parent::init($settings); $defaults = array('servers' => array('127.0.0.1'), 'compress' => false); $this->settings = array_merge($this->settings, $defaults, $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 =& 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; }
/** * 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()) { if (!class_exists('Memcache')) { return false; } parent::init(array_merge(array('engine' => 'Memcache', 'prefix' => Inflector::slug(APP_DIR) . '_', 'servers' => array('127.0.0.1'), 'compress' => false), $settings)); if ($this->settings['compress']) { $this->settings['compress'] = MEMCACHE_COMPRESSED; } if (!is_array($this->settings['servers'])) { $this->settings['servers'] = array($this->settings['servers']); } if (!isset($this->__Memcache)) { $return = false; $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 $return; } return true; }
/** * 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('PHP_AUTH_USER' => 'cake', 'PHP_AUTH_PW' => 'cake'); $this->settings = am($this->settings, $defaults, $settings); return function_exists('xcache_info'); }
/** * Initialize the cache engine * * Called automatically by the cache frontend * * @param array $params Associative array of parameters for the engine * @return boolean true if the engine has been succesfully initialized, false if not * @access public */ function init($settings = array()) { if (!function_exists('eaccelerator_put')) { return false; } return parent::init(array_merge(array('engine' => 'Eaccelerator', 'prefix' => Inflector::slug(APP_DIR) . '_'), $settings)); }
public function init($settings = array()) { $settings += array('engine' => 'DbTable', 'storage' => 'cache_db', 'prefix' => '', 'duration' => false, 'serialize' => true); parent::init($settings); $this->model = new DbCache(false, $this->settings['storage']); return true; }
/** * 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 bool True if the engine has been successfully initialized, false if not */ public function init($settings = []) { if (!class_exists('Memcached')) { return false; } if (!isset($settings['prefix'])) { $settings['prefix'] = Inflector::slug(APP_DIR) . '_'; } $settings += ['engine' => 'Memcached', 'servers' => ['127.0.0.1'], 'compress' => false, 'persistent' => true]; parent::init($settings); $this->_keys .= $this->settings['prefix']; if (!is_array($this->settings['servers'])) { $this->settings['servers'] = [$this->settings['servers']]; } if (!isset($this->_Memcached)) { $return = false; $this->_Memcached = new Memcached($this->settings['persistent'] ? 'mc' : null); $this->_setOptions(); if (!count($this->_Memcached->getServerList())) { $servers = []; foreach ($this->settings['servers'] as $server) { $servers[] = $this->_parseServerString($server); } if ($this->_Memcached->addServers($servers)) { $return = true; } } if (!$this->_Memcached->get($this->_keys)) { $this->_Memcached->set($this->_keys, ''); } return $return; } return true; }
/** * 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 */ public function init($settings = array()) { if (!isset($settings['prefix'])) { $settings['prefix'] = Inflector::slug(APP_DIR) . '_'; } $settings += array('engine' => 'Apc'); parent::init($settings); return function_exists('apc_dec'); }
/** * 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 */ public function init($settings = array()) { if (!isset($settings['prefix'])) { $settings['prefix'] = Inflector::slug(APP_DIR) . '_'; } $settings += array('engine' => 'Wincache'); parent::init($settings); return function_exists('wincache_ucache_info'); }
/** * 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 */ public function init($settings = array()) { if (!class_exists('Redis')) { return false; } parent::init(array_merge(array('engine' => 'Redis', 'prefix' => null, 'server' => '127.0.0.1', 'port' => 6379, 'password' => false, 'timeout' => 0, 'persistent' => true), $settings)); return $this->_connect(); }
function init($settings = array()) { parent::init(array_merge(array('engine' => 'SuperStack', 'prefix' => Inflector::slug(APP_DIR) . '_'), $settings)); foreach ($settings['stack'] as $key => $stack) { Cache::config($key, $stack); } return true; }
/** * 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 bool True if the engine has been successfully initialized, false if not */ public function init($settings = array()) { if (php_sapi_name() !== 'cli') { parent::init(array_merge(array('engine' => 'Xcache', 'prefix' => Inflector::slug(APP_DIR) . '_', 'PHP_AUTH_USER' => 'user', 'PHP_AUTH_PW' => 'password'), $settings)); return function_exists('xcache_info'); } return false; }
/** * 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 bool True if the engine has been successfully initialized, false if not */ public function init($settings = array()) { if (!class_exists('Redis')) { return false; } parent::init(array_merge(array('engine' => 'Redis', 'prefix' => Inflector::slug(APP_DIR) . '_', 'server' => '127.0.0.1', 'database' => 0, 'port' => 6379, 'password' => false, 'timeout' => 0, 'persistent' => true, 'unix_socket' => false), $settings)); return $this->_connect(); }
/** * 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('className' => 'Cache', 'fields' => array('data', 'expires')); $this->settings = am($this->settings, $defaults, $settings); if (!class_exists($this->settings['className']) && !loadModel($this->settings['className'])) { $this->__Model = new $modelName(); } else { $this->__Model = new Model(array('name' => $this->settings['className'])); } }
/** * 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 */ public function init($settings = array()) { parent::init(array_merge(array('engine' => 'File', 'path' => CACHE, 'prefix' => 'cake_', 'lock' => true, 'serialize' => true, 'isWindows' => false, 'mask' => 0664), $settings)); if (DS === '\\') { $this->settings['isWindows'] = true; } if (substr($this->settings['path'], -1) !== DS) { $this->settings['path'] .= DS; } return $this->_active(); }
/** * 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 bool True if the engine has been successfully initialized, false if not * @see CacheEngine::__defaults */ public function init($settings = array()) { if (!isset($settings['prefix'])) { $settings['prefix'] = Inflector::slug(APP_DIR) . '_'; } $settings += array('engine' => 'Apc'); parent::init($settings); if (function_exists('apcu_dec')) { $this->_apcExtension = 'apcu'; return true; } return function_exists('apc_dec'); }
/** * 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(array_merge(array('engine' => 'NamespaceFile', 'path' => CACHE, 'prefix' => 'cake.', 'lock' => false, 'serialize' => true, 'isWindows' => false), $settings)); if (!isset($this->File)) { if (!class_exists('File')) { App::import('File'); } $this->File = new File($this->settings['path']); } if (DS === '\\') { $this->settings['isWindows'] = true; } return $this->__active(); }
/** * 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('className' => 'CacheModel', 'fields' => array('data', 'expires')); $this->settings = array_merge($this->settings, $defaults, $settings); $className = $this->settings['className']; $this->__fields = $this->settings['fields']; if (App::import($className)) { $this->__Model = ClassRegistry::init($className); } else { $this->__Model = new Model(array('name' => $className)); } return true; }
/** * 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 bool True if the engine has been successfully initialized, false if not * @throws CacheException when you try use authentication without Memcached compiled with SASL support */ public function init($settings = array()) { if (!class_exists('Memcached')) { return false; } if (!isset($settings['prefix'])) { $settings['prefix'] = Inflector::slug(APP_DIR) . '_'; } if (defined('Memcached::HAVE_MSGPACK') && Memcached::HAVE_MSGPACK) { $this->_serializers['msgpack'] = Memcached::SERIALIZER_MSGPACK; } $settings += array('engine' => 'Memcached', 'servers' => array('127.0.0.1'), 'compress' => false, 'persistent' => false, 'login' => null, 'password' => null, 'serialize' => 'php', 'options' => array()); parent::init($settings); if (!is_array($this->settings['servers'])) { $this->settings['servers'] = array($this->settings['servers']); } if (isset($this->_Memcached)) { return true; } if (!$this->settings['persistent']) { $this->_Memcached = new Memcached(); } else { $this->_Memcached = new Memcached((string) $this->settings['persistent']); } $this->_setOptions(); if (count($this->_Memcached->getServerList())) { return true; } $servers = array(); foreach ($this->settings['servers'] as $server) { $servers[] = $this->_parseServerString($server); } if (!$this->_Memcached->addServers($servers)) { return false; } if ($this->settings['login'] !== null && $this->settings['password'] !== null) { if (!method_exists($this->_Memcached, 'setSaslAuthData')) { throw new CacheException(__d('cake_dev', 'Memcached extension is not build with SASL support')); } $this->_Memcached->setOption(Memcached::OPT_BINARY_PROTOCOL, true); $this->_Memcached->setSaslAuthData($this->settings['login'], $this->settings['password']); } if (is_array($this->settings['options'])) { foreach ($this->settings['options'] as $opt => $value) { $this->_Memcached->setOption($opt, $value); } } return true; }
/** * 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(array_merge(array('engine' => 'File', 'path' => CACHE, 'prefix' => 'cake_', 'lock' => false, 'serialize' => true, 'isWindows' => false), $settings)); if (!isset($this->_File)) { $this->_File =& new File($this->settings['path'] . DS . 'cake'); } if (DIRECTORY_SEPARATOR === '\\') { $this->settings['isWindows'] = true; } $path = $this->_File->Folder->cd($this->settings['path']); if ($path) { $this->settings['path'] = $path; } return $this->__active(); }
/** * 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' => CACHE, 'prefix' => 'cake_', 'lock' => false, 'serialize' => true); $this->settings = am($defaults, $this->settings, $settings); if (!isset($this->__File)) { $this->__File =& new File($this->settings['path'] . DS . 'cake'); } $this->settings['path'] = $this->__File->Folder->cd($this->settings['path']); if (!is_writable($this->settings['path'])) { trigger_error(sprintf(__('%s is not writable', true), $this->settings['path']), E_USER_WARNING); return false; } return true; }
/** * 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 */ public function init($settings = array()) { $settings += array('engine' => 'File', 'path' => CACHE, 'prefix' => 'cake_', 'lock' => true, 'serialize' => true, 'isWindows' => false, 'mask' => 0664); parent::init($settings); if (DS === '\\') { $this->settings['isWindows'] = true; } if (substr($this->settings['path'], -1) !== DS) { $this->settings['path'] .= DS; } if (!empty($this->_groupPrefix)) { $this->_groupPrefix = str_replace('_', DS, $this->_groupPrefix); } return $this->_active(); }
/** * Initialize the Redis 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 */ public function init($settings = array()) { $this->settings = array_merge(array('engine' => 'Redis', 'prefix' => Inflector::slug(basename(dirname(dirname(APP)))) . '_'), $settings, RedisCache::settings('cache')); parent::init($this->settings); if (!isset($this->redis)) { $this->redis = new Redis(); $this->redis->pconnect($this->settings['hostname'], $this->settings['port']); if (defined('Redis::SERIALIZER_IGBINARY')) { $this->redis->setOption(Redis::OPT_SERIALIZER, Redis::SERIALIZER_IGBINARY); } else { $this->redis->setOption(Redis::OPT_SERIALIZER, Redis::SERIALIZER_PHP); } } return true; }
/** * 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(array_merge(array('engine' => 'File', 'path' => CACHE, 'prefix' => 'cake_', 'lock' => false, 'serialize' => true, 'isWindows' => false), $settings)); if (!isset($this->__File)) { if (!class_exists('File')) { require LIBS . 'file.php'; } $this->__File =& new File($this->settings['path'] . DS . 'cake'); } if (DIRECTORY_SEPARATOR === '\\') { $this->settings['isWindows'] = true; } $this->settings['path'] = $this->__File->Folder->cd($this->settings['path']); if (empty($this->settings['path'])) { return false; } return $this->__active(); }
/** * 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(array_merge(array('engine' => 'File', 'path' => CACHE, 'prefix' => 'cake_', 'lock' => false, 'serialize' => true, 'isWindows' => false), $settings)); if (!isset($this->__File)) { if (!class_exists('File')) { uses('file'); } $this->__File =& new File($this->settings['path'] . DS . 'cake'); } if (substr(PHP_OS, 0, 3) == "WIN") { $this->settings['isWindows'] = true; } $this->settings['path'] = $this->__File->Folder->cd($this->settings['path']); if (empty($this->settings['path'])) { return false; } return $this->__active(); }
/** * 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 * @throws CacheException when you try use authentication without Memcached compiled with SASL support */ public function init($settings = array()) { if (!class_exists('Memcached')) { return false; } if (!isset($settings['prefix'])) { $settings['prefix'] = Inflector::slug(APP_DIR) . '_'; } $settings += array('engine' => 'Memcached', 'servers' => array('127.0.0.1'), 'compress' => false, 'persistent' => false, 'login' => null, 'password' => null, 'serialize' => 'php'); parent::init($settings); if (!is_array($this->settings['servers'])) { $this->settings['servers'] = array($this->settings['servers']); } if (isset($this->_Memcached)) { return true; } $this->_Memcached = new Memcached($this->settings['persistent'] ? (string) $this->settings['persistent'] : null); $this->_setOptions(); if (count($this->_Memcached->getServerList())) { return true; } $servers = array(); foreach ($this->settings['servers'] as $server) { $servers[] = $this->_parseServerString($server); } if (!$this->_Memcached->addServers($servers)) { return false; } if ($this->settings['login'] !== null && $this->settings['password'] !== null) { if (!method_exists($this->_Memcached, 'setSaslAuthData')) { throw new CacheException(__d('cake_dev', 'Memcached extension is not build with SASL support')); } $this->_Memcached->setSaslAuthData($this->settings['login'], $this->settings['password']); } return true; }
/** * Initialize the Cache Engine * * Called automatically by the cache frontend * To reinitialize the settings call Cache::config('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 */ public function init($settings = array()) { $defaults = array('engine' => 'Ninja.Database', 'model' => 'Temporariness', 'prefix' => '', 'serialize' => true, 'fields' => array('key' => 'id', 'value' => 'value', 'expires' => 'expires')); parent::init(Set::merge($defaults, $settings)); return true; }
/** * 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' => CACHE, 'prefix' => 'cake_', 'lock' => false, 'serialize' => true); $this->settings = array_merge($defaults, $this->settings, $settings); if (!isset($this->__File)) { $this->__File =& new File($this->settings['path'] . DS . 'cake'); } $this->settings['path'] = $this->__File->Folder->cd($this->settings['path']); if (empty($this->settings['path'])) { return false; } return $this->__active(); }
/** * 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 * @see CacheEngine::__defaults * @access public */ function init($settings = array()) { parent::init(array_merge(array('engine' => 'Apc', 'prefix' => Inflector::slug(APP_DIR) . '_'), $settings)); return function_exists('apc_cache_info'); }