1

Possible Duplicate:
Using Memcache vs Memcached with PHP

I'm using AWS Elasticache and I've installed there php module which I believe is an extension of spymemcached. The catch is I believe I'm running memcache and not memcached. This is the code to create the object:

$memcached = new Memcached();
$memcached->setOption(Memcached::OPT_CLIENT_MODE, Memcached::DYNAMIC_CLIENT_MODE);
$memcached->addServer('goneglobalcache-1a.expalp.cfg.apse1.cache.amazonaws.com', 11211);
$memcached->set('key', 'value', 60);

When I go to write to the cache I can't use compression settings and was advised the problem is I'm using a memcache client.

Is there a way to tell which type of client I'm using and a way to switch?

Community
  • 1
  • 1
Adam
  • 19,932
  • 36
  • 124
  • 207

2 Answers2

3

There is only one Memcached server in the world. But there are two PHP client libraries, one named "Memcache", the other "Memcached".

There are differences: When should I use Memcache instead of Memcached?

Which one you'll need should be documented in the software's requirements.

Community
  • 1
  • 1
Sven
  • 69,403
  • 10
  • 107
  • 109
2

If you want to use Memcache, you need to install (compile) that PHP extension.

$memcache = new Memcache;
$memcache->set('key', 'value', MEMCACHE::COMPRESSED, 60);

But note that Memcache compression uses zlib which need to be installed.

epicdev
  • 922
  • 4
  • 10