简体   繁体   中英

http caching vs other caching strategies in Rails

I have read about Http caching and the three strategies found in rails (page/action/fragment) and I want to ask why would I use the other strategies when http caching exists? .

Because HTTP caching can only cache the whole page, so it is comparable to page caching in Rails, the most basic caching.

With fragment caching, you can cache parts of your site, that are repeated on multiple pages, ie a menu that is dynamically generated.
These repeated fragments can be quite time consuming (in one of my projects, the menu, shown on every page, was extracted from several thousand pages and took over 500ms to generate.
So caching this fragment saved me 500ms on every page hit.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM