Using memcached as a Grails cache
Thanks to Ray Krueger’s hibernate-memached plugin, I have PatriotRoom.com using memached as a 2nd level and query cache.
Why use memached instead of the standard OSCache provider? Two reasons.
One, I’m not overly fond of taking up memory heap for the cache when it can be used for the application itself. This should reduce GC usage as well, and unless I’m missing something the cache should survive application restarts. Giving the amount of cache hits the application gets this would be a big help.
Two, I plan on clustering the application pretty soon, if I can get terracotta working, (that’ll be another post) and having the memached cache means I have a cache that can be used across the two servers.
Yes, I could have done this via clustering OSCache, but this is much simpler.
Ray has some pretty good documentation and the only thing that wasn’t clear was a couple of jars needed (the slf4j ones), but it wasn’t too big of a deal.
07/14/09 12:46am
07/14/09 12:45am
07/13/09 06:19pm
06/25/09 08:55am
webmogul: Using memcached as a Grails cache http://tinyurl.com/969g9n 01/18/09 07:32am
Don’t miss anything, subscribe!
Did you enjoy this post? Why not leave a comment below and continue the conversation, or subscribe to my feed and get articles like this delivered automatically to your feed reader.


Thanks for the comment Jordan. After taking a quick look, one thing sticks out for me and that is that it is an in-process cache. If I wanted that I would have stuck with OSCache which is the default cache provider for Grails.
I wanted an external cache for the two servers to talk to. I haven’t used, or heard of, sccache, but memcached is a very lightweight and fast cache server, exactly what I wanted. Also, there was a hibernate cache provider for it already, making it just a config change along with a few jars.