Heroku 上的頁面緩存技巧? (Page caching trick on Heroku?)


問題描述

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 KongCarson Cole)

參考文件

  1. Page caching trick on Heroku? (CC BY-SA 3.0/4.0)

#caching #ruby-on-rails #Heroku






相關問題

Heroku 上的頁面緩存技巧? (Page caching trick on Heroku?)

Array of Structs selalu lebih cepat daripada Structs of arrays? (Array of Structs are always faster than Structs of arrays?)

使用 Varnish 更改標頭中的引用者 (Change Referrer in header using Varnish)

清理 ios 中的 uiwebview 緩存 (clean uiwebview cache in ios)

緩存整個表 (Caching the entire table)

過期/緩存控制標頭的問題 (Problem with Expires/Cache-Control Headers)

強制 L1 緩存上的一些數據 (force some data on L1 cache)

Facebook API - 在服務器上緩存響應 (Facebook API - cache response on server)

ASIHTTPRequest 離線模式連接失敗 (ASIHTTPRequest offline mode connection failure)

如果小於 X 天,如何從磁盤讀取文件,如果舊,則重新獲取 html 文件 (How to read a file from the disk if less than X days old, if older, refetch the html file)

當您的應用服務器託管在不同的雲服務上時,如何安全地從 Firebase 託管上的 CDN 緩存中受益 (How to safely benefit from CDN caching on Firebase Hosting when your app's server is hosted on a different Cloud service)

如何使用java處理緩存中的鎖定(ConcurrentHashMap) (How to handle lock in cache (ConcurrentHashMap) using java)







留言討論