Ejemplo n.º 1
0
 public function getDriver()
 {
     if (!$this->_driver) {
         $this->_driver = new \Redis();
         if (!isset($this->_config['handler_config'])) {
             throw new Exception("Cannot found config for Redis Session Handler");
         }
         $cfg = array_merge(array('host' => '127.0.0.1', 'port' => 6379, 'db' => 0), $this->_config['handler_config']);
         $this->_driver->connect($cfg['host'], $cfg['port'], 30);
         $this->_driver->select($cfg['db']);
         if (isset($cfg['auth']) && !empty($cfg['auth'])) {
             $this->_driver->auth($cfg['auth']);
         }
     }
     return $this->_driver;
 }