san*_*anx 4 google-app-engine webapp2
youtube上有这个新视频,展示了GAE架构中EdgeCaching的优势,在视频的这个特定点上,它们展示了它的易用性:http://www.youtube.com/watch?v = QJp6hmASstQ #T = 11m12
不幸的是,这并不容易......
我希望使用Google提供的webapp2框架启用边缘缓存.
我打电话给:
self.response.pragma = 'Public'
self.response.cache_expires(300)
Run Code Online (Sandbox Code Playgroud)
但它似乎被其他东西所取代.
我得到的标题是:
HTTP/1.1 200 OK
Pragma: Public
Cache-Control: max-age=300, no-cache
Expires: Sat, 23 Feb 2013 19:15:11 GMT
Content-Type: application/json; charset=utf-8
Content-Encoding: gzip
X-AppEngine-Estimated-CPM-US-Dollars: $0.000085
X-AppEngine-Resource-Usage: ms=39 cpu_ms=64
Date: Sat, 23 Feb 2013 19:10:11 GMT
Pragma: no-cache
Expires: Fri, 01 Jan 1990 00:00:00 GMT
Cache-Control: no-cache, must-revalidate
Vary: Accept-Encoding
Server: Google Frontend
Content-Length: 600
Run Code Online (Sandbox Code Playgroud)
我正在使用ndb顶级:
app = ndb.toplevel(webapp2.WSGIApplication(...
Run Code Online (Sandbox Code Playgroud)
我尝试了这里解释的技术,但它们似乎不适用于webapp2:http://code.google.com/p/googleappengine/issues/detail? id = 2258#c14
我也看过这篇文章:https: //groups.google.com/d/topic/webapp2/NmHXoZZSVvo/discussion
我试图手动设置所有内容但没有成功.有些东西覆盖了我的缓存设置.
有没有办法让它与webapp2一起使用?欢迎任何其他选择.
编辑:我正在使用版本前缀的URL:http://version.appname.appspot.com,这可能是我的问题的原因.
这应该是你所需要的:
self.response.cache_control = 'public'
self.response.cache_control.max_age = 300
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2803 次 |
| 最近记录: |