與服務器或客戶端爲什麼Rack :: Cache在etag匹配時沒有達到緩存?
第一個請求
GET /post/1 HTTP/1.1
HTTP/1.1 200 OK
Date: Fri, 05 Mar 2010 09:05:46 GMT
Last-Modified: Thu, 04 Mar 2010 21:00:08 GMT
X-Rack-Cache: miss
Etag: "c226165d5817af7c91592dab0bc0ac63"
Cache-Control: max-age=3600, public
緩存被錯過和Rails被擊中,並查詢數據庫中沒有緩存開始:
if stale?(:etag => @document, :last_modified => @document.updated_at.utc) # => true
expires_in 1.hour, :public => true
@post = Post.find(params[:id])
end
第二個請求
GET /post/1 HTTP/1.1
If-Modified-Since: Thu, 04 Mar 2010 21:00:08 GMT
If-None-Match: "c226165d5817af7c91592dab0bc0ac63"
Cache-Control: max-age=0
HTTP/1.1 304 Not Modified
Date: Fri, 05 Mar 2010 09:10:04 GMT
X-Rack-Cache: miss
Etag: "c226165d5817af7c91592dab0bc0ac63"
Cache-Control: max-age=3600, public
緩存被遺漏,Rails被擊中,但是發送304的時候不會進行修改,數據庫沒有命中:
if stale?(:etag => @document, :last_modified => @document.updated_at.utc) # => false
expires_in 1.hour, :public => true
@post = Post.find(params[:id])
end
但是我的印象是這應該打的高速緩存,因爲ETag相符(如果 - 無 - 匹配/ Etag的)下?