1

I have implemented the action caching in rails 3.2 with following syntax

 caches_action :show, { 
 :unless => proc {|c| 
  current_user.present? || @current_member.present? || @is_crawler 
  },   :cache_path => proc { |controller| 
   controller.params.merge(:device => "#{device_type.to_s}")}}

But However I want the action cache to expire for all versions of the device type whenever the caching is updated. I am using the following syntax in controller. expire_action( :action => :show)

Sadly enough the above code does not work as intended. Quite frankly I am new to using caching and any help is much appreciated.

xecutioner
  • 311
  • 3
  • 15
  • first of all, try to be more explicit when you ask questions or describe your problem. "does not work as intended" is a pretty bad error description. what was your intention and how did the result diverge from it? – phoet Oct 13 '14 at 12:52
  • Hmm sorry if I was not descriptive enough. When calling the update action in the controller i am using `expire_action(:action => :show)` But this does not clear the cache and still serves the cached version. – xecutioner Oct 14 '14 at 05:25
  • 1
    you need to match whatever is part of the cache-path to clear it. i don't know if you can use a regular expression or something like that, otherwise, use a custom cache sweeper. all in all, action-caching is considered deprecated, use an in-memory cache like memcached to do such things. – phoet Oct 14 '14 at 13:56
  • @phoet Thanks for the help. I will post the answer on how I got it working. – xecutioner Oct 15 '14 at 05:12

0 Answers0