Beispiel #1
0
 protected function connect($config = array())
 {
     if (empty($config)) {
         $config = $this->_configName;
     }
     $_config = array();
     /** @var \Yaf\Config\Ini $sysConfig */
     $sysConfig = Registry::get('config');
     if ($sysConfig && ($tmp = $sysConfig->get($config))) {
         $_config = $tmp->toArray();
     } elseif (is_array($config)) {
         $_config = $config;
     }
     $_config['adapter'] = 'Redis';
     $_config['params'][\Redis::OPT_PREFIX] = $this->_keyPrefix ?: get_class($this);
     $_config['params'][\Redis::OPT_SERIALIZER] = \Redis::SERIALIZER_PHP;
     return Cache::instance('__redis_model__', $_config);
 }
Beispiel #2
0
 public function init()
 {
     \eYaf\Cache::instance('_yac');
     //缓存
 }