Conditional Page Caching [Solution: Conditional Fragment Caching]

后端 未结 3 896
-上瘾入骨i
-上瘾入骨i 2021-01-12 08:36

Suppose that I have controller home_controller.rb with action index.

I want to cache index page so I\'m doing:

caches_page          


        
3条回答
  •  感情败类
    2021-01-12 09:23

    What you want couldn't be achieved;

    A page is cached or is not cached. The process checks the existence of a html file or process it.

    Still you have two alternatives:

    • use action caching or fragment caching (not recommended)

    • more recommended: load user specific part with ajax so you'll only have one page always cached and specific data inserted dynamically (like stackoverflow)

    Here are state of the art explanations: http://railslab.newrelic.com/scaling-rails

提交回复
热议问题