سؤال

I'm using Memcached and Dalli store for my rails app.

Is there a way to set something like expires_in and gzip for caches_action?

هل كانت مفيدة؟

المحلول

Just add them to the caches_action invocation line as cache parameters; all parameters that are not specific to caches_action will be passed to the actual memcache fetch call.

caches_action :show, :unless => proc {current_user},
  :cache_path => proc {"post_#{params[:id]}"},
  :expires_in => 10.seconds,
  :race_condition_ttl => 2.seconds

I use Dalli and Rails 3.1.3, and this code works as intended. I suppose, gzipping would also work.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top