Few queries on atomicity of requests

Ryan LeCompte lecompte at gmail.com
Fri Jun 20 19:08:31 UTC 2008


Do you normally use memcached in Rails or primarily in Java (I figured
Java since you wrote spymemcached) :-)


On Fri, Jun 20, 2008 at 3:00 PM, Dustin Sallings <dustin at spy.net> wrote:
> On Jun 20, 2008, at 11:42, Daniel wrote:
> Wouldn't it be nice to get the speed boost of caching in all parts of
> your application without needing to complicate your code with memcached
> requests AND database requests?
> We get that in rails.  You just say something like ``SomeType.get_cache
> 81754'' to get a SomeType from the cache.  If it's not in the cache, it'll
> get it from the DB and put it in the cache and then return the value.
> Similarly, if you add this to your model:
> after_save :reset_cache
> It will automatically freshen the cache after you save a record.
> If it complicates the API, you're probably doing it wrong.
> Of course, you can do more complicated stuff, but it's only incrementally
> more complicated code.
> --
> Dustin Sallings

More information about the memcached mailing list