Module: ActionController::Caching::Pages

Extended by:
ActiveSupport::Concern
Included in:
ActionController::Caching
Defined in:
lib/action_controller/caching/pages.rb

Defined Under Namespace

Modules: ClassMethods

Constant Summary collapse

INSTANCE_PATH_REGEX =
/^\/(\w+)\/(\d+)/

Instance Method Summary collapse

Instance Method Details

#cache_page(content, path) ⇒ Object



33
34
35
36
# File 'lib/action_controller/caching/pages.rb', line 33

def cache_page(content, path)
  Rails.logger.info "[page cache]caching: #{path}"
  RedisPage.redis.set(path, content)
end

#record_cached_pageObject



38
39
40
41
42
43
# File 'lib/action_controller/caching/pages.rb', line 38

def record_cached_page
  path, model_name, model_id = INSTANCE_PATH_REGEX.match(request.path).to_a
  if model_id
    mark_cache_instance(model_name, model_id)
  end
end