module HalApi::Controller::Cache::ClassMethods

Public Instance Methods

cache_api_action(action, options = {}) click to toggle source
# File lib/hal_api/controller/cache.rb, line 31
def cache_api_action(action, options = {})
  options = cache_options.merge(options || {})
  cache_path_method = options.delete(:cache_path_method)
  cache_path_method ||= "#{action}_cache_path"
  unless options[:cache_path]
    options[:cache_path] = lambda do |c|
      c.send(:valid_params_for_action, action).merge _c: send(cache_path_method)
    end
  end
  caches_action(action, options)
end
cache_options() click to toggle source
# File lib/hal_api/controller/cache.rb, line 43
def cache_options
  { compress: true, expires_in: 1.hour, race_condition_ttl: 30 }
end