Exemplo n.º 1
0
 private function connect()
 {
     if (self::$connected === true) {
         return true;
     }
     if (class_exists('Memcached')) {
         $this->memcached = new Memcached();
         if ($this->memcached->addServer($this->host, $this->port)) {
             return self::$connected = true;
         } else {
             EpiException::raise(new EpiCacheMemcacheConnectException('Could not connect to memcache server'));
         }
     }
     EpiException::raise(new EpiCacheMemcacheClientDneException('No memcache client exists'));
 }
Exemplo n.º 2
0
 private function connect()
 {
     if (self::$connected === true) {
         return true;
     }
     if (class_exists('Memcache')) {
         $this->memcached = new Memcache();
         if (@$this->memcached->connect($this->host, $this->port)) {
             return self::$connected = true;
         } else {
             throw new EpiCacheMemcacheConnectException('Could not connect to memcache server', 0);
         }
     }
     throw new EpiCacheMemcacheClientDneException('No memcache client exists', 0);
 }