禁用ExtJs应用程序的缓存 [英] Disable caching for ExtJs app
问题描述
我们有一个使用Sencha cmd 5.0.1.231构建的ExtJS 5.01应用程序。
We have a ExtJS 5.01 app built with Sencha cmd 5.0.1.231.
我们面临的问题是浏览器似乎缓存了我们应用程序的旧版本。在我们的应用程序发布时,在查看Chrome上的网络流量时,我可以看到app.js,app.css文件都附加了_dc = {timestamp}。现在,这告诉我,每当我的应用程序的新版本被发布(更新这个时间戳)时,浏览器应该得到一个新的版本。但是,似乎有时候仍然旧版本得到了服务。
The issue we are facing is that browsers seem to cache the old version of our application. On looking at the network traffic on chrome when our application is served, i can see that app.js, app.css files all have ?_dc={timestamp} appended to them. Now, that tells me that every time a new version of my app is released (which updates this timestamp), the browsers should get a new version. But it seems like sometimes still the old version get served.
还有什么我需要做超级缓存吗?
Is there anything else i need to do bust cache?
谢谢
推荐答案
我不明白为什么有时浏览器缓存文件,即使默认情况下禁用缓存。我甚至强制框架尽可能使用缓存,通过将这个安全的代码放在我的 app.js
中:
I don't get it why "sometimes" the browser is caching your files, even when caching is disabled by default. I even force the framework to use cache whenever possible, by putting this peace of code in my app.js
:
Ext.Loader.setConfig({
enabled: true,
disableCaching: false
});
在开发我开发我的DevTools并设置 禁用缓存(当DevTools打开时)
。这不允许Chrome缓存文件。
While developing I open up my DevTools and set Disable cache (while DevTools is open)
. This will not allow Chrome to cache files.
但可能是在您的 app.json
中,您强制通过设置更新
或appcache
,将缓存到本地存储空间。检查您的本地存储和您的app.json以验证。
But it could be that in your app.json
you are forcing "caching" into your local storage by setting "update"
or "appcache"
. Check your localstorage and your app.json to verify.
这篇关于禁用ExtJs应用程序的缓存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!