問題描述
Heroku 上的頁面緩存技巧? (Page caching trick on Heroku?)
I am moving a rails app to Heroku. Heroku doesn't seem to support page caching. So I generated cached pages on my development machine and checked them in to Heroku.
For example, /about_us generates public/about_us.html. But when I call /about_us, public/about_us.html doesn't seem to be called.
Should my trick work?
Thanks.
Sam
參考解法
方法 1:
In Rails 3, you'll be using the assets pipeline, so your assets--about_us.html--will be precompiled and put into a folder, WITHIN your public folder. Usually, this file will not be located at 'public/about_us.html'.
With your assets now precompiled, they'll be statically available and appended with an id, that will uniquely identify this asset until it is changed. With the unique signature, caching will occur on both Heroku's (last I checked) as well as within browsers.
Basically, the asset pipeline is doing this already for you.
(by Sam Kong、Carson Cole)