PECL memcache extension

Jehiah Czebotar jehiah at
Mon Feb 6 00:23:15 UTC 2006

I have to offer my opinion; because i think changing the client
extension will only fix some of the cases where you may get stale data
in memcached due to failover / disconnects.

Consider a scenareo like this : (for simplicity assume you use
persistant connections on the client side)

server A is a consumer of memcached data only
server B is a consumer, and provider of memcache data.

some issue causes server B to be unable to update memcached cached
data (but it still updates the back end data source).

server A gets stale data because it doesn't know it should be failling
back to db because that logic was implemented only in the client code
on server B

In a senario like this (which is the absolute worst case I can think
of) the only way to be 100% sure memcached has no stale data is to (on
the memcached side) flush the data after every disconnect.

Yeah that sounds drastic but think it through. Even though not all
disconnects are un-intentional (and leading to stale data) this would
reliable catch 100% of the cases where you could get stale data. Yes
it could significantly lower your hit ratio; but that might be a small
price to pay for peace of mind.

If nothing else, it sounds like it would be a usefull command line
switch to me, and i'll be adding it to my java memcached port.


Jehiah at

More information about the memcached mailing list