Пример #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;
 }
Пример #2
0
 /**
  * @param int &$it
  * @param string $pattern
  * @param int $count
  * @return array|FALSE
  */
 public function scan(&$it, $pattern, $count)
 {
     $start = microtime(true);
     $result = parent::scan($it, $pattern, $count);
     $this->logger->log('scan', microtime(true) - $start, func_get_args(), $result);
     return $result;
 }