Memcached Database Use

Ivan Krstić krstic at
Sat Jun 23 19:02:30 UTC 2007

Chris Miller wrote:
> I see how that by storing database results in memcached would be very
> helpful, but how does memcached know when the result set in cache has
> changed?

memcached is a stupid blob cache with no notion of stale data. You put
stuff into it, and often -- but not always -- you can get that stuff
back out later. Putting stuff in and getting it out is pretty fast.
That's the extent of its functionality.

While you can instruct memcached to expire keys after a while, it'll
once again fall squarely on your application to repopulate the cache
with updated information after a cache miss.

For a somewhat read-biased query ratio on your database, memcached will
often prove to be an immediate win over the built-in query cache (which
is reset on every table update). But the real performance wins come from
understanding that, for sufficiently large sites, you are in fact
willing to not show information updated in real time, and no, it won't
be the end of the world.

Ivan Krstić <krstic at> | GPG: 0x147C722D

More information about the memcached mailing list