/** * * @return boolean */ public function connect() { if (!$this->isEnabled()) { return false; } $this->connected = $this->memcache->connect($this->config["host"], $this->config["port"]); return $this->connected; }
private function buildRedisCache() { if (null === $this->host) { throw new HostShouldBeProvidedException(); } if (null === $this->port) { $this->port = Redis::DEFAULT_PORT; } if (null === $this->timeout) { $this->timeout = Redis::DEFAULT_TIMEOUT; } $this->server->connect($this->host, $this->port, $this->timeout); $this->server->setOption(\Redis::OPT_SERIALIZER, \Redis::SERIALIZER_PHP); $ro = new \ReflectionObject($this->cacheProvider); $redisProperty = $ro->getProperty('redis'); $redisProperty->setAccessible(true); $redisProperty->setValue($this->cacheProvider, $this->server); }