Sha256: 8afe982b24d53aa006ac88e451e04801dd30f495c0db6d33e9504c468587fa78

Contents?: true

Size: 458 Bytes

Versions: 1

Compression:

Stored size: 458 Bytes

Contents

module RestrictCache
  module 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.1 lib/restrict_cache/action_controller_ext.rb