How To Distinguish Between a Crashed Server and Non-Existent Memcached Key Value?

Garrett Rooney rooneg at electricjellyfish.net
Thu Jun 1 12:25:10 UTC 2006


On 6/1/06, EKC <webmaster at generalsynthesis.com> wrote:

> How can I differentiate between a missing KEY->server mapping (when
> Cache::Memcached::get() returns undef) and a crashed server (which
> also results in 'undef')?

If you are using memcached correctly you should not differentiate
between the two cases.  You should always be able to handle the case
where memcached does not have a particular value, the exact reason it
doesn't have it is meaningless, that's core to the way it works.  For
example, you could also get an undef response simply because the cache
filled up and dropped that value out of it.  You still need to handle
that case as well.

-garrett


More information about the memcached mailing list