Sha256: 630decc3ab5dcf6ae2fa588240aea49b07379c6abb00fa7b9c2f2a8b8a5d680b

Contents?: true

Size: 511 Bytes

Versions: 1

Compression:

Stored size: 511 Bytes

Contents

module RestrictCache
  module RailsExt
    module ActionController
      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
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
restrict_cache-0.1.2 lib/restrict_cache/rails_ext/action_controller.rb