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

Reply via email to