Strategies to cache from MySQL (or any DB I suppose)
jcoby at listingbook.com
Mon Nov 7 06:29:16 PST 2005
> Obviously, when checking to see if the cache exists for that, I
> suppose I could use "posts:$threadid" for the key. But then I have to
> make sure that any time I may modify a row returned from that query, I
> have to dirty the cache for any already-cached information with
> threadid of $threadid.
> Hopefully I'm making sense. Perhaps someone else has some BKMs on how
> to change/break up database operations so that I can do caching on
> nearly every type of SELECT I will use. Because I'd like to leverage
> memcache for everything possible.
Well, if you use postgresql, there is the pgmemcache extension. I don't
know how easy mysql is to extend (or have it call an external process in
a trigger), but you may be able to write something similar?
> File caching is easy - the key would always be the filename (or some
> sort of token based on it) - but the database stuff gets interesting
> based on how the data is being retrieved, and also how it's updated.
> Thanks in advance,
More information about the memcached