Turbocache does not cache

瀏覽次數:44 次
跳到第一則未讀訊息

Jens Ravens

未讀,
2016年4月19日 清晨6:30:572016/4/19
收件者:Phusion Passenger Discussions
Currently with my app I cannot get the turbocache to work. 

I'm using Passenger standalone 5.0.27 with Rails 5.0.0.beta3 on heroku. My application returns these headers:

Date: Tue, 19 Apr 2016 10:20:57 GMT
Content-Type: application/json; charset=utf-8
Cache-Control: max-age=1800, public
ETag: W/"3ef53dea5823895a1d18da8ad11a1453"

According to the docs this should be enough to get the http-cache up and running.

When I run this request (multiple times of course)

GET /v1/shops/krasserstoff HTTP/1.1
Host: myapp.herokuapp.com
Connection: close
User-Agent: Paw/2.3.3 (Macintosh; OS X/10.11.4) GCDHTTPRequest

the application still hits the database each time and runs the whole rails-stack.

Did I miss something?

Daniel Knoppel

未讀,
2016年4月19日 清晨6:56:212016/4/19
收件者:Phusion Passenger Discussions
What might be affecting you is that the maximum body size for [turbocache] cacheable requests is currently hard coded to 32 KB. See also: https://github.com/phusion/passenger/issues/1430

- Daniel

Jens Ravens

未讀,
2016年4月19日 清晨6:58:432016/4/19
收件者:Phusion Passenger Discussions
The whole response that comes out of passenger is this one:

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Transfer-Encoding: chunked
Connection: close
Status: 200 OK
Cache-Control: max-age=1800, public
Date: Tue, 19 Apr 2016 10:57:02 GMT
ETag: W/"3ef53dea5823895a1d18da8ad11a1453"
X
-Frame-Options: SAMEORIGIN
X
-XSS-Protection: 1; mode=block
X
-Content-Type-Options: nosniff
X
-Runtime: 0.349508
X
-Request-Id: 11966929-7757-4b88-8652-e76b2737e1fd
X
-Powered-By: Phusion Passenger 5.0.27
Server: nginx/1.8.1 + Phusion Passenger 5.0.27


{"id":1,"slug":"krasserstoff"}

body size therefore shouldn't be an issue.

Daniel Knoppel

未讀,
2016年4月19日 上午9:57:182016/4/19
收件者:Phusion Passenger Discussions
Maybe you're not repeating fast enough? The cache times out after 2 sec (or shorter, if the validity of the response is shorter).

You can raise the log-level as done in the GH thread I mentioned to see what's going on exactly.

Jens Ravens

未讀,
2016年4月19日 上午10:27:052016/4/19
收件者:Phusion Passenger Discussions
Thank you. Look's like I've run into the same issue. Even if i manually do several requests within 2 seconds, it just works "sometimes". Which is not actually what I would expect from this feature. I'll just go with nginx in front of it instead.
回覆所有人
回覆作者
轉寄
0 則新訊息