Esempio n. 1
0
 public function __construct()
 {
     if (!extension_loaded('memcache')) {
         throw new \RuntimeException('memcache扩展未加载');
     }
     $this->options = Config::get('cache.memcache');
     if (!$this->options) {
         $this->options = array('expire' => 0, 'prefix' => 'onefox_', 'servers' => array(array('host' => '127.0.0.1', 'port' => 11211, 'persistent' => false, 'weight' => 100)));
     }
     $this->_connect();
 }
Esempio n. 2
0
 public function __construct()
 {
     if (!extension_loaded('redis')) {
         throw new \RuntimeException('redis扩展未加载');
     }
     $this->options = Config::get('cache.redis');
     if (!$this->options) {
         $this->options = array('expire' => 0, 'prefix' => 'onefox_', 'server' => array('host' => '127.0.0.1', 'port' => 6379));
     }
     $this->_connect();
 }
Esempio n. 3
0
 public function __construct()
 {
     $this->options = Config::get('cache.file');
     if (!$this->options) {
         $this->options = array('path' => APP_PATH . DS . 'Cache', 'expire' => 0, 'prefix' => 'onefox_');
     }
     if (substr($this->options['path'], -1) != '/') {
         $this->options['path'] .= '/';
     }
     // 创建应用缓存目录
     if (!is_dir($this->options['path'])) {
         mkdir($this->options['path']);
     }
 }