After removing caches_page cached sites are still

2019-06-05 14:46发布

问题:

I played a bit with caching. I added caches_page :show to my ArticlesController and it causes me terrible pain. I removed the caches_page from the controller but nothing happened. I restarted the server (thin + nginx) but nothing happened.

I cleaned the cache via console Rails.cache.clear in production mode and restarted the server again. Now it's working again for the articles I didn't call but the one that were cached are still not refreshed. I already cleaned the cache of my browser but it doesnt help.

How can I get rid of this buggie behavior?

回答1:

Page cache generates an HTML page which it stores in your public directory. Even though you disabled the caching, the cached page remained there. Rails by default serves files in public without going through the routes.

You need to delete this html page for rails to hit the action again.