Error handling for Memcached PHP Extension

Cabbar Duzayak cabbar at
Sun Feb 25 00:41:10 UTC 2007

Hi all,

I have started using the PHP extension at for memcached. But, one problem I
am having right now is that, php functions tells you nothing about

For example, when you call Memcache::get, it returns true or false,
but when it returns false does this mean item is not found, or
Memcached is down, or there is a cache corruption / compression error,
etc. etc. And, this also is the case for Memcache::set, again when it
returns false, you have no idea about what is going on. I tried
turning debugging on, and this did not help much.

As far as I can see, memcache internally sets error nos, but this
extension completely ignores these errors. And, I saw something like:

"PHP Notice:  Memcache::get(): marked server 'localhost:11211' as
failed" in my php logs for some of the requests (like 5-10 out of a
thousand), but server was up, and everthing was normal, and the
request after that succeeded.

In summary, is it possible to get these errors from PHP somehow so
that we can have an idea about what is going on and how we can handle
them? Possibly with something like "mysql_error" or "mysql_errno"

Thanks in advance...

More information about the memcached mailing list