Module: ActionParamCaching::Rails::ActionController

Defined in:
lib/action_param_caching/rails/action_controller.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#action_cache_configsObject (readonly)

Returns the value of attribute action_cache_configs.



4
5
6
# File 'lib/action_param_caching/rails/action_controller.rb', line 4

def action_cache_configs
  @action_cache_configs
end

Instance Method Details

#cache_with_params(options = {}) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/action_param_caching/rails/action_controller.rb', line 6

def cache_with_params(options = {})
  @action_cache_configs = {} if @action_cache_configs.nil?

  options[:on].each do |action|
    @action_cache_configs[action] = ActionParamCaching::ActionConfig.new(self.controller_path, action, options[:with_set_or_subset], options[:filter_starting_with], options[:expires_in]) unless @action_cache_configs[action]
  end

  options[:on].each do |action|
    config = @action_cache_configs[action]

    unless config.did_config_cache
      caches_action action, config.cache_args
      config.did_config_cache = true
    end
  end

  if options[:expires_in]
    caches_action :expires_in => options[:expires_in]
  end
end