【发布时间】:2013-02-09 06:46:28
【问题描述】:
youtube 上有一段新视频展示了 EdgeCaching 在 GAE 架构中的优势,在视频的这个特定点上,他们展示了利用它是多么容易: http://www.youtube.com/watch?v=QJp6hmASstQ#t=11m12
不幸的是,这并不容易......
我希望使用 Google 提供的 webapp2 框架启用边缘缓存。
我在打电话:
self.response.pragma = 'Public'
self.response.cache_expires(300)
但它似乎被其他东西覆盖了。
我得到的标题是:
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
我正在使用 ndb 顶级:
app = ndb.toplevel(webapp2.WSGIApplication(...
我尝试了这里解释的技术,但它们似乎不适用于 webapp2: http://code.google.com/p/googleappengine/issues/detail?id=2258#c14
我也看过这篇文章: https://groups.google.com/d/topic/webapp2/NmHXoZZSVvo/discussion
我尝试手动设置所有内容,但没有成功。某些东西正在覆盖我的缓存设置。
有没有办法让它与 webapp2 一起工作?欢迎任何其他选择。
编辑:我正在使用带有版本前缀的网址:http://version.appname.appspot.com,这可能是我的问题的原因。
【问题讨论】:
-
"边缘缓存仅适用于 Google Apps 域,对 appspot.com 没有影响"See this post