/** * Construct * * Do not use this directly. You can use getInstance() instead. * @param string $url url of memcache * @return void */ function CacheMemcache($url) { //$config['url'] = array('memcache://localhost:11211'); $config['url'] = is_array($url) ? $url : array($url); $this->Memcache = new Memcache(); foreach ($config['url'] as $url) { $info = parse_url($url); $this->Memcache->addServer($info['host'], $info['port']); } }
/** * Construct * * Do not use this directly. You can use getInstance() instead. * @param string $url url of memcache * @return void */ function __construct($url) { //$config['url'] = array('memcache://localhost:11211'); $config['url'] = is_array($url) ? $url : array($url); if (class_exists('Memcached')) { $this->Memcache = new Memcached(); $this->SelectedExtension = 'Memcached'; } elseif (class_exists('Memcache')) { $this->Memcache = new Memcache(); $this->SelectedExtension = 'Memcache'; } else { return false; } foreach ($config['url'] as $url) { $info = parse_url($url); $this->Memcache->addServer($info['host'], $info['port']); } }