GAE java缓存问题

GAE java缓存问题,java,javascript,google-app-engine,http,caching,Java,Javascript,Google App Engine,Http,Caching,我正在Google App Engine中开发一个Java应用程序,我遇到了一个问题。 我希望能够从管理控制台控制应用程序数据库,但它似乎工作不正常,当我更改数据库中的数据时,它不会反映在应用程序上,即我有一个要锁定的用户,因此我更改了值active=“false”,我可以在数据库中看到新的值,但当应用程序发出另一个请求时,我会得到以前的值(JSON格式) 我假设它与缓存有关,所以我尝试从JavaScript和Java中取消它,如下所示: JavaScript: $.ajaxSetup({

我正在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"
    }
});
爪哇:


我还能做什么?

您可以尝试配置服务器。假设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>
#mod#u expires指令:
#启用expires/max age标头,并将默认值设置为距离上次访问时间0秒
过期于
到期默认A0
#在特定类型上配置ExpiresByType,例如ExpiresByType文本/css A0
#mod_头指令:
#发送各种无缓存指令,应涵盖任何古怪的客户端和网关
标题集缓存控制“最大年龄=0,专用,无缓存,无存储,必须重新验证,代理重新验证,无转换”
标题集Pragma“无缓存”
#将此附在特定文件的指令中,例如

这是一篇解释网页缓存的好文章:

我发现了我的问题,这不是缓存的问题,而是持久性管理器的问题


我使用了2个PM实例,这就是产生差异的原因。

Holle,我如何在运行java的GAE上实现它?您可以通过这个
# 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>