NOOB: How to use memcached?

Harry McIntyre mcintyre321 at gmail.com
Thu Apr 12 09:24:32 UTC 2007


Hi I have been given the job of implementing memcached for our site and was
wondering if I have the right idea about how to go about it. Sorry if this
is a bit long!

Our site consists of a whole load of forums and similar. Looking up the data
for a forum page requires several joins (to get the user name of the current
user, etc. etc).

Lets say an item like "select a.*, b.* FROM a inner join b on b.foreignKey =
a.key where a.key = 154". I would hash the sql and store this in memcached.
Now I can get that result back anytime. So far so good.

Now I read the stuff about implementing namespaces in memcached so you can
do an invalidate a namespace with a single call. I can see how this can be
used to clear memcached entries when they correspond to an item with a
dependency, but the query above needs to be invalidated if the a row
changes, or if any of the linked b rows change - in essence requiring
multiple namespaces for each memcached item.

Is is better to
1. cache every database row as a unique item and do all joins in memory on
the application server, getting missing objects from the database in
batches
2. to implement a layer providing multiple namespaces for each memcached
item which will be quite costly in terms of memcached lookups and/or CPU
time or
3. bark up a different tree ?

thanks for your time everyone!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.danga.com/pipermail/memcached/attachments/20070412/3c30600c/attachment.html


More information about the memcached mailing list