Sha256: 1df88f7909e00a91189734cbb0020475eca729a50bf0fbfbc8c98397172cce5b

Contents?: true

Size: 457 Bytes

Versions: 1

Compression:

Stored size: 457 Bytes

Contents

module RestrictCache
  class ActionControllerExt
    include ActiveSupport::Concern

    module ClassMethods
      def cache_sweep_action(*args)
        options = args.extract_options!
        actions = args.empty? ? {} : {only: args}
        options.merge! actions unless actions.empty?
        around_action :sweep_restrict_cache, options
      end
    end

    def sweep_restrict_cache
      yield
    ensure
      RestrictCache.clear
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
restrict_cache-0.1.0 lib/restrict_cache/action_controller_ext.rb