简体   繁体   English

谷歌是否会加密缓存外部请求?

[英]Does Google appengine cache external requests?

I have a very simple application running on appengine that requests a web page every five minutes and parses for a specific piece of data. 我有一个非常简单的应用程序在appengine上运行,每五分钟请求一个网页并解析一段特定的数据。

Everything works fine except that the response I get back from the external request (using urllib2) doesn't reflect the latest changes to the page. 一切正常,除了我从外部请求(使用urllib2)返回的响应不反映页面的最新更改。 Sometimes it takes a few minutes to get the latest, sometimes over an hour. 有时需要几分钟才能获得最新信息,有时需要一个多小时。

Is there a transparent layer of caching that appengine puts in place? 是否有一个透明的缓存层,即appengine到位? Or is there something else I am missing here? 或者还有其他我在这里缺少的东西? I've looked at the caching headers of the requested page and there is no Expires, LastModified or ETags headers sent. 我查看了所请求页面的缓存标题,并且没有发送Expires,LastModified或ETags标头。

Update: Sometimes, it will get the new version of the page for a number of requests and then randomly later get an old out of date version. 更新:有时,它会获得许多请求的新版本页面,然后随机获得旧的过时版本。

It appears that this is an issue the App Engine team is aware of . 这似乎是App Engine 团队所知道的问题 The suggested workaround is to set Cache-Control header with max-age in seconds: 建议的解决方法是使用max-age以秒为单位设置Cache-Control标头:

result = urlfetch.fetch(url, headers = {'Cache-Control' : 'max-age=240'})

should hopefully work for you. 应该有希望为你工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM