Rails cache expire

前端 未结 3 2217
遇见更好的自我
遇见更好的自我 2021-02-20 11:42

I have a rails application, in that I am using simple rails cache. My testing is as follows:

Rails.cache.write(\'temp\',Date.today,:expires_in => 60.seconds)
         


        
3条回答
  •  清歌不尽
    2021-02-20 11:56

    The :expires_in option only works with compatible stores (eg memcached) - not memory.

    From http://guides.rubyonrails.org/caching_with_rails.html:

    Finally, if you are using memcached or Ehcache, you can also pass :expires_in. In fact, all parameters not used by caches_action are sent to the underlying cache store.

提交回复
热议问题