有什么方法可以强制重置AppEngine上所有缓存的静态文件? [英] Any way to force reset of all cached static files on AppEngine?

查看:83
本文介绍了有什么方法可以强制重置AppEngine上所有缓存的静态文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了一个已知的AppEngine问题,如果我转到应用程序的特定URL,则会缓存错误的静态内容,但是如果我附加一个?foo参数来破坏缓存,则会显示正确的静态内容,而VERSION .myapp.appspot.com也可以。

I am running into a known AppEngine issue where the wrong static content is cached if I go to a particular URL for my app, but the right static content shows up if I append a ?foo parameter to bust the cache, and VERSION.myapp.appspot.com works too.

有什么方法可以在未修改的URL上显示正确的内容?

Is there any way to get the correct content showing up at the unmodified URL?

我很乐意删除该应用并还原它或其他任何令人毛骨悚然的东西。该应用程序尚未上线,但我需要在几个小时内上线。任何使这些URL正常运行的东西,以便与AppEngine应用进行通话的移动应用都能获得正确的数据。

I would be happy to delete the app and restore it or anything drastic. The app isn't live, but I need it to be in a couple of hours. Anything to get those URLS working so the mobile app talking to the AppEngine app gets the right data.

EDIT

卷曲标题,我看到:

HTTP/1.1 200 OK
ETag: "ZN9VxQ"
Date: Tue, 14 Aug 2012 02:00:58 GMT
Expires: Wed, 15 Aug 2012 02:00:58 GMT
Content-Type: text/html
Server: Google Frontend
Cache-Control: public, max-age=86400
Age: 34623
Transfer-Encoding: chunked

我还用软管扎了50,000秒吗?是否要缩短它?

Am I hosed for another 50,000 seconds? Anyway to shorten that?

编辑评论:

在app.yaml中,我有这个处理程序:

In app.yaml, I have this handler:

- url: /static
  static_dir: static
  expiration: 1s

我现在尝试删除到期时间:

I have now tried removing the expiration:

- url: /static
  static_dir: static

然后根据文档将其添加到app.yaml的顶部:

And I added this to the top of app.yaml, based on the docs:

default_expiration: "1m"

此外,删除文件并不会使它们在我部署时消失。

Also, deleting files doesn't make them disappear when I deploy.

推荐答案

这取决于所使用的缓存控件。

It the depends on what cache-control is used. Check in firebug och chrome inspector and see what expiration date are set.

如果将缓存控件设置为public,则不会影响该控件,因为文件已设置

If you've set the cache-control to public you can't affect the control since the files are cache on various proxies and server along the way.

如果使用cache-control private,则应该能够重置浏览器缓存并保持良好状态,但是正如您所说的那样有时您会从Google的生产环境中获取错误的文件。我遇到了同样的问题。最快的解决方案是在加载的文件中添加查询参数。

If you use cache-control private you should be able to reset you browser cache and be fine, but as you say sometimes you get the wrong files from Google's production environment. I've had the same problem. The fastest solution is to add a query param to the files loaded.

这篇关于有什么方法可以强制重置AppEngine上所有缓存的静态文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆