/** * Constructor取得 * * @param array $config * * @see http://jp.php.net/manual/ja/function.memcache-addserver.php */ public function __construct(array $config) { parent::__construct($config); $options = array('cacheDir' => _BEAR_APP_HOME . '/tmp/cache_lite/', 'automaticSerialization' => true, 'automaticCleaningFactor' => 100); // _adapterをCache_Liteに $this->_adapter = BEAR::dependency('Cache_Lite', $options); }
/** * Constructor * * @param array $config * * @see http://jp.php.net/manual/ja/function.Apc-addserver.php * @throws BEAR_Cache_Exception */ public function __construct(array $config) { parent::__construct($config); $app = BEAR::get('app'); $this->_config['info'] = $config['info']; if (!extension_loaded('apc') || !ini_get('apc.enabled') || !function_exists('apc_sma_info')) { throw new BEAR_Cache_Exception('APC extention is not loaded'); } else { if ($this->_config['debug']) { $apcSmaInfo = apc_sma_info(); BEAR::dependency('BEAR_Log')->log('APC', $apcSmaInfo); } } }
/** * Constructor * * @param array $config * * @see http://jp.php.net/manual/ja/function.memcache-addserver.php * @throws BEAR_Cache_Exception */ public function __construct(array $config) { parent::__construct($config); if (!extension_loaded('memcache')) { throw new BEAR_Cache_Exception('Memcached extention is not loaded'); } $this->_adapter = new Memcache(); //キャッシュサーバー追加 if (isset($this->_config['path'])) { foreach ($this->_config['path'] as $path) { $this->_adapter->connect($path); } } $log = array(); if ($this->_config['debug'] && isset($this->_config['path'])) { $log['Ver'] = $this->_adapter->getVersion(); BEAR::dependency('BEAR_Log')->log('Memcache', $log); } return $this->_adapter; }