Page cache is not expiring

Asked

Viewed 40 times

2

I am using the caches_page in a controller in my application in Rails 4.

caches_page :index, expires_in: 10.minutes

I need to have this controller run again after 10 minutes and generate a new page. When I run this in the production environment after 10 minutes the page is not expired.

I am using the :memory_store in my config

  config.consider_all_requests_local       = false
  config.action_controller.perform_caching = true
  config.cache_store = :memory_store

How can I fix this?

Thank you!

1 answer

1


I figured out what the problem is. expires_in only works if you are using Memcached or something similar (like Redis, for example).

It still only works in caches_action. The caches_page is made for pages that will never be changed or run manually in the controller the expires_page('/route').

Source: http://apidock.com/rails/v3.2.3/ActionController/Caching/Actions

  • You can mark your answer as correct to "close" the question.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.