mperham/dalli — Issue #136: expires_in problem
Author: professor
Created: 2011-11-05 18:18:02+00:00
State: open

I'm sure that I am making a very easy mistake.

I'm preparing to use memcache and dalli for the first time and carefully read through the Dali readme and these two web pages:
http://devcenter.heroku.com/articles/memcache
https://github.com/mattmanning/memcache-example

I'd like to expire caches 15 seconds after creating them on a Rails 3.0.9 site using heroku. I decided to modify memcache-example to see if I could get expiration to work on my local machine. It does not. I modified the develoment.rb file

development.rb
MemcacheExample::Application.configure do
config.cache_store = :dalli_store, {:expires_in => 15 }
end

The first clue that I'm doing something wrong is that 1.day (the example in the Dalli readme) doesn't work, the rails time commands aren't usable in the environment configuration files.

After putting something into the cache, I look at the Rails.cache. I see that DalliStore has a 15 second expiration, but the Dalli Client does not.

Rails.cache
=> #15}, @data=#0}, @ring=nil>, @thread_local_key=:active_support_cache_dalli_store_local_cache_2162092540, @middleware=ActiveSupport::Cache::Strategy::LocalCache>