Ejemplo n.º 1
0
 public function __construct(App_Google_Client $client)
 {
     if (!function_exists('memcache_connect') && !class_exists("Memcached")) {
         $error = "Memcache functions not available";
         $client->getLogger()->error($error);
         throw new App_Google_Cache_Exception($error);
     }
     $this->client = $client;
     if ($client->isAppEngine()) {
         // No credentials needed for GAE.
         $this->mc = new Memcached();
         $this->connection = true;
     } else {
         $this->host = $client->getClassConfig($this, 'host');
         $this->port = $client->getClassConfig($this, 'port');
         if (empty($this->host) || empty($this->port) && (string) $this->port != "0") {
             $error = "You need to supply a valid memcache host and port";
             $client->getLogger()->error($error);
             throw new App_Google_Cache_Exception($error);
         }
     }
 }