How to cache Comfy ComfortableMexicanSofa pages to reduce page load time

183 Views Asked by At

I want to reduce my application load time, I am using Comfy ComfortableMexicanSofa cms with rails 4.2, I want to cache whole page so that when a user hit a URL from browser my application does not load cms page content from db just load that page from cache.

1

There are 1 best solutions below

0
Grocery On

You gotta overwrite this controller: https://github.com/comfy/comfortable-mexican-sofa/blob/master/app/controllers/comfy/cms/content_controller.rb

Just copy it into your own app/controllers/comfy/cms folder. Then wrap that render call with cache @cms_page do. That should reduce DB access a bit. The reason why it's not there by default is because page content may include partials/helpers that are dynamic (like currently logged-in user).

If you want to have full page caching - look into Apache/Nginx caching. Rails doesn't do page caching anymore. Also Amazon's CloudFront.