libmemcache and pgmemcache...

Sean Chittenden sean at
Tue Nov 23 13:27:25 PST 2004

>> Howdy.  Last night I gave a presentation on pgmemcache and libmemcache
>> to the San Francisco PostgreSQL User Group.  For the interested 
>> parties,
>> the presentation is available at:
> Hi Sean / list,
> pgmemcache is just about exactly what I'm looking for - excellent job!
> The way I'm thinking of using it in my application is to have "for each
> row after insert/update/delete" triggers in Postgres, which do a
> memcached "delete".  Thus, when the database is modified, the cache is
> automatically invalidated.  The checking of the cache, and the
> population thereof, would be done elsewhere.

Ah, excellent.  That's basically how I use it now[1].

> Anyway, on to my question... how mature / stable / well-tested is this
> work?  I'm trying it out on my dev box here, and so far it's behaving,
> but I'm a little reluctant to install it on our production server
> without hearing maybe a few encouraging noises from other people... I'm
> timid like that ;-)

Heh, I don't blame you.  I've been using it for about 2-3 weeks now 
(one in a half in its current revision) without any failures.  I was 
exceedingly paranoid in the way that I wrote it.  Assuming your 
memcached server is working well and not violating the protocol (ps, 
Brad: reminder: commit my patch to docs/protocol *grin*), you won't 
have any problems.  I've thumped on my setup without any incident, 
memory leaks, or crashes.  Since this is still so new, I haven't 
collected a list of users or success stories, but I'm very interested 
in them.  If you have questions on best practices, I seem to be 
settling in on a good set of policies.

> P.S. Why not call it "libmemcache*d*" / "pgmemcache*d*"?  Seems more
> obvious, given the name of the thing it's all based on.

Good question, originally I had the library as libmemcached, but 
realized that the library name isn't correct.  The daemon is called 
memcached, meaning that memcached is providing the memcache service.  
libmemcache is a library for using that memory caching layer, not for 
using the daemon.  libmemcached means to me, an API to control 
memcached (ie, invoking memcached via the command line).  -sc

PS  If anyone is interested in helping fund work to add ON COMMIT 
triggers to PostgreSQL (would dramatically improve data synchronization 
between memcached and PostgreSQL), please contact me off list.

Sean Chittenden

More information about the memcached mailing list