scheme = $scheme; $this->host = $host; $this->port = $port; $this->password = $password; $this->redis = null; $this->connect(); } protected function connect() { // already connected if ($this->redis != null) return $this->redis; // if password is specified attempt connection if (strlen($this->password) > 0) { $this->redis = new PredisClient([ "scheme" => $this->scheme, "host" => $this->host, "port" => $this->port, "password" => $this->password]); return $this->redis; } $this->redis = new PredisClient([ "scheme" => $this->scheme, "host" => $this->host, "port" => $this->port]); return $this->redis; } public function getRedisClient() { return $this->redis; } }