Expiration of controller action from Sweeper does not work

Having a controller handling rendering of large XML feeds

module Spree
  class FeedsController < Spree::StoreController
    ...

    caches_action :products_out
    cache_sweeper FeedSweeper

    # XML feed in format of `xxxxxxx.com'
    def products_out
      @products = Product.all
      respond_to do |format|
        format.xml
      end
    end
end

Bellow is the corresponding sweeper's sublass:

module Spree
  class FeedSweeper< ActionController::Caching::Sweeper
    observe Product

    def after_update(product)
      # cache_configured? is nil, @controller is nil here, why ?
      expire_action(:controller => :feeds,
                    :action     => :products_out,
                    :format     => :xml)
    end
end

Above Spree::FeedSweeper is called when Spree::Product gets updated, however it seems expire_action silently dies and cache won't get invalidated.

Can somebody explain the issue ? Even better suggest some solution ?

Thanks.

Answers


Which Rails version are you using? expire_action seems to be deprecated after Rails 3.2.14.

Maybe you can try to find out the key then directly clear it with Rails.cache.delete(key).


Need Your Help

Why does my vb.net title bar come out white

.net winforms visual-studio visual-styles nonclient-area

For some reason, when I am designing my Windows Application, the form outline/title bar is blue in colour, but when the application runs, it comes out white. Why does it do this and how do I get it...

SVN Menu not showing up in Spring tool suite

svn subclipse spring-tool-suite javahl

I am working on Mac OS X Version 10.9. I have SVN Version 1.8.8 installed on this. Also I am using Subclipse 1.10.4 as a plugin in my STS. I have SVNKit v1.8.4.10145 installed as well as