예제 #1
0
 public function __construct($server = 'localhost', $port = 11211)
 {
     if (empty(self::$memcache)) {
         self::$memcache = new \Memcache();
         self::$memcache->connect($server, $port) or die("Could not connect");
     }
 }
예제 #2
0
 public function __construct($server = 'localhost', $port = 11211)
 {
     if (empty(self::$memcache)) {
         if (!class_exists('Memcache')) {
             throw new \Exception('You need to have the php memcached extension');
         }
         self::$memcache = new \Memcache();
         self::$memcache->connect($server, $port) or die("Could not connect");
     }
 }