Java 如何禁用tomcat缓存?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3743136/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
how to disable tomcat caching?
提问by Ivan
how to disable tomcat caching? I use this -
如何禁用tomcat缓存?我用这个 -
<Context antiJARLocking="true" antiResourceLocking="true" cachingAllowed="false" cacheMaxSize ="0" cacheTTL="1">
in Tomcat/conf/context.xml
在 Tomcat/conf/context.xml 中
but it not helps
但它没有帮助
回答by Colin Hebert
I'm not sure what you're using, but in context.xml you can change the value of cachingAllowed
by removing the flag.
我不确定您在使用什么,但在 context.xml 中,您可以cachingAllowed
通过删除标志来更改 的值。
Remember to delete the cache folder after that.
记得在那之后删除缓存文件夹。
Resources :
资源 :
On the same topic :
在同一主题上:
回答by Ivan
Actual problem is antiResourceLocking="true"
.
实际问题是 antiResourceLocking="true"
。
Looks like there is a conflict with cachingAllowed="false"
.
看起来有冲突cachingAllowed="false"
。
回答by amine
cachingAllowed did not help. I resolved this by modifying :
cachingAllowed 没有帮助。我通过修改解决了这个问题:
$CATALINA_HOME/conf/Catalina/localhost/thewebapp.xml
which is the cached file of context.xml
这是context.xml的缓存文件
回答by Ravi Shekhar
Put below code in your sever.xml file.
将以下代码放入您的 sever.xml 文件中。
<Context className="org.apache.catalina.core.StandardContext"
cachingAllowed="false"
charsetMapperClass="org.apache.catalina.util.CharsetMapper"
cookies="true"
reloadable="false"
wrapperClass="org.apache.catalina.core.StandardWrapper">
</Context>
Make sure to delete all data from /work/Catalina/localhost directory before restarting tomcat. Also clear your browser cache.
确保在重新启动 tomcat 之前删除 /work/Catalina/localhost 目录中的所有数据。还要清除浏览器缓存。
Its a good practice to disable browser caching while your app is in development. This post may help Disabling Chrome cache for website development
在您的应用程序处于开发阶段时禁用浏览器缓存是一个很好的做法。这篇文章可能有助于为网站开发禁用 Chrome 缓存