简体   繁体   中英

Rails fragment caching not working locally

I've added the following at the top of my index.html.haml:

- cache do

  content

And as far as I can see, the content is not cached. My server output shows that when I reload the page, it still fetches all the info from the database again.

I haven't tried on live as I don't want to push anything before it's 100% working. What am I doing wrong? Am I not understanding how it's supposed to work? I've set the config.action_controller.perform_caching = true .

cache_store configures which cache store to use for Rails caching so you need to specify that

You need to set cache store in general config.

config.cache_store = xyz,abc       # PUT THIS 

Options that you can set:

 :memory_store, :file_store, :mem_cache_store

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