/** * Get Redis handler * * @return \Redis */ public function getHandler() { if (!$this->handler) { $this->handler = new \Redis(); if ($this->settings['connection_persistent']) { $this->handler->pconnect($this->settings['host'], $this->settings['port'], $this->settings['timeout']); } else { $this->handler->connect($this->settings['host'], $this->settings['port'], $this->settings['timeout']); } if (isset($this->settings['options'])) { foreach ($this->settings['options'] as $key => $value) { $this->handler->setOption($key, $value); } } } return $this->handler; }