コード例 #1
0
 /**
  * @return Storage|NULL
  */
 public function connect()
 {
     if ($this->keep_connected && $this->storage !== NULL) {
         return $this->storage;
     }
     if ($this->logger) {
         $redis = new LogRedis($this->logger);
     } else {
         $redis = new Redis();
     }
     $cc = $this->config;
     $redis->connect($cc->host, $cc->port, $cc->timeout, $cc->persistent_id, $cc->retry_interval);
     if (!$redis->isConnected()) {
         return NULL;
     }
     $this->storage = new Storage($redis, $this->translator);
     return $this->storage;
 }