Rails fragment cache with memcached-client and time-based :expire option
The robot-coop’s memcache-client is the recommended memcache library to use for Rails. However, when I tried to use it with the Rails fragment cache, I found it was simply incompatible. Rails fragment cache wanted read() and write() methods, but the library only provided get() and set(). I took this opportunity to write a very simple plugin that not only provides those wrappers, but also allows easy time-based expiry syntax:
<% cache ‘mykey’, :expire => 10.minutes do %> …










4 Comments