Reputation: 25
On the first page, I have this
// start memcached
$m = new Memcached();
$m->addServer('localhost', 11211);
$key = 'test_' . $ID_ref;
$test_data = array(....);
$m->set($key, $test_data);
// end memcached
OK, so far. On the next page,
// start memcached
$m = new Memcached();
$m->connect('localhost', 11211);
var_dump($m->get($key));
// end memcached
The following error occured:
Call to undefined method Memcached::connect()
phpinfo()
shows that memcached is installed by webhost, and it seems that memcached does not support connect()
What should I use instead?
Upvotes: 0
Views: 2191
Reputation: 12332
Rather than
$m = new Memcached();
$m->connect('localhost', 11211);
simply re-use
$m = new Memcached();
$m->addServer('localhost', 11211);
connect()
is a Memcache method and not Memcached
Upvotes: 3