How To Distinguish Between a Crashed Server and Non-Existent
Memcached Key Value?
webmaster at generalsynthesis.com
Thu Jun 1 07:02:37 UTC 2006
I'm using Cache::Memcached off of CPAN to take my entire database and
load it into Memcached. Less than 10% of the hits to my perl script
result in writes to the database -- those writes go directly to the
database, which are then reloaded into Memcached.
So, the only time I want to hit the database is before and after a
write is commited, or when a memcached server crashes.
However, when I call Cache::Memcached->get(KEY) and receive 'undef', I
cannot determine whether the 'undef' implies that the KEY was never
loaded into Memcached with Cache::Memcached->set(KEY, VALUE), or if
the server hosting KEY is down.
I've set 'no_rehash' in Cache::Memcached to true. However get(KEY)
still returns 'undef' both when the server that KEY maps to is down
_and_ when there is no KEY->server mapping.
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')?
Thanks in advance,
More information about the memcached