我正在Google App Engine中开发一个Java应用程序,我有一个问题。我希望能够从管理控制台控制应用程序数据库,但它似乎不能正常工作,当我更改数据库中的数据时,它没有反映在应用程序上,即我有一个用户,我想要锁定,所以我更改了值active = "false",我可以在数据库中看到新值,但当应用程序发出另一个请求时,我会得到以前的值返回( JSON格式)。
我假设它与缓存有关,所以我尝试从JavaScript和Java中取消它,如下所示:
JavaScript:
$.ajaxSetup({
cache: false,
type: 'POST',
headers: {
"cache-control": "'no-cache, max-age=0",
"Pragma": "no-cache"
}
});Java:
response.addHeader("Cache-Control", "no-cache, private, must-revalidate, max-age=0");
response.addHeader("Pragma", "no-cache");我还能做什么?
发布于 2014-08-31 18:43:49
我发现了我的问题,不是缓存的问题,而是持久性管理器的问题。
我使用了2个PM实例,这就是出现差异的原因。
发布于 2014-08-31 15:04:02
您可以尝试配置您的server.Assuming apache:
# mod_expires directives:
# enable expires/max-age headers and set default to 0 seconds from last access time
ExpiresActive On
ExpiresDefault A0
# configure ExpiresByType on your specific types, eg ExpiresByType text/css A0
# mod_headers directives:
# send variety of no-cache directives, should cover any quirky clients and gateways
Header set Cache-Control "max-age=0, private, no-cache, no-store, must-revalidate, proxy-revalidate, no-transform"
Header set Pragma "no-cache"
# enclose this in <Files> directive for specific file eg <Files *.js>这是一篇很好的解释网页缓存的文章:http://www.mnot.net/cache_docs/
https://stackoverflow.com/questions/25589524
复制相似问题