java - 通过 GAE 进行 http 请求时,GAE 是否缓存数据?

标签 java http google-app-engine servlets

当在 GAE 中接收 http 帖子时,我从另一台服务器下载一个 txt 文件,进行一些解析,然后返回信息。但是,当我更新此 txt 文件并尝试通过 GAE 访问它时,似乎出现了延迟。这是一步一步的解释:

  1. 我更新服务器 A 上的 txt 文件。

  2. 我通过访问服务器 A 上的 txt 文件来验证 txt 文件是否已更新。

  3. 我注意到通过 GAE(从服务器 A 获取 txt)访问同一个 txt 文件时有 5-10 分钟的延迟。

也许问题不在于 GAE 缓存,但还可能是什么?

最佳答案

尝试设置client cache control在您的 GAE URL 获取代码中:

URL urlObj = new URL(url); 
HttpURLConnection connection = (HttpURLConnection) 
urlObj.openConnection(); 
connection.addRequestProperty("Cache-Control", "no-cache,max-age=0"); 
connection.addRequestProperty("Pragma", "no-cache"); 

看起来work for some people .

关于java - 通过 GAE 进行 http 请求时,GAE 是否缓存数据?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9863908/

相关文章:

Android:Loopj AsyncHttpClient 获取 HTTP 错误代码

google-app-engine - 由于删除了暂存存储桶,gcloud 应用程序部署失败

python - Google AppEngine、Django 和 request.FILES

java - 如何使用 Redis 适配器写入 Geode,然后使用 Geode 客户端读取/响应事件?

java - 在使用 : ((JavascriptExecutor)seleniumdriver). executeScript ("return arguments[0].attributes);", webElement 之后,超出了最大调用堆栈大小;

java - Antlr4 - 多行文件解析器 -

php - 强制http/https : How to detect https and which status header to send when redirecting?

java - cucumber-jvm junit 报告和 maven-surefire-plugin

javascript - CORS:如果从浏览器或从脚本内访问 URL,策略会有所不同

google-app-engine - 部署后如何浏览和发现 Cloud Endpoints 公开的 REST API