jeudi 18 janvier 2018

rails 3 production add caching to index page

I have a rails 3 app and wanted the index page to not take "time" when reloading the page.
I have added caches_page :index in the controller.rb file and @page_caching = true in the index function.
How can i make the index page update every 15mns the query and not take time to load the page in between that 15mns caching.

class HomeController < ApplicationController

caches_page :index

def index
    @page_caching = true    

/config/environments/production.rb
config.action_controller.perform_caching = true

Aucun commentaire:

Enregistrer un commentaire