invalidation by namespace Re: Listing all keys on a server: why?

Martin Atkins mart at
Fri Jul 28 17:56:44 UTC 2006

Brian Moon wrote:
> Yes, yes and yes (I think I counted right).
> ok, I did not follow the rest of this stuff so I will skip it.
> I should clearly say that I did not think of this.  Someone else posted
> this idea to this list some time ago.  I tried to find it in the archive
> so that I could properly give them credit, but alas, my searching did
> not work.

I posted something along these lines:

The main caveat with the approach was the race condition after doing the 
increment with clients that had already fetched the old key but hadn't 
yet fetched the data.

My proposed solution back then was to allow clients to "lock" memcache 
and allow them to execute multiple commands atomically, which would 
solve other problems in the process. This locking could probably be 
implemented in a semaphore-like fashion on top of memcached, or it could 
be implemented with ddlockd.

Of course, this little race is unlikely to be of concern to most apps, 
since they'll already have a race between updating the database and 
invalidating the cached data.

More information about the memcached mailing list