禁用 ExtJs 应用程序的缓存 [英] Disable caching for ExtJs app

查看:15
本文介绍了禁用 ExtJs 应用程序的缓存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个使用 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.json中设置app.js的更新属性为full:

Set the update property for app.js to full in app.json:

{
    // Path to file. If the file is local this must be a relative path from this app.json file.
    "path": "app.js",

    "bundle": true,  /* Indicates that all class dependencies are concatenated into this file when build */

    // If 'update' not specified, this file will only be loaded once, and cached inside
    // localStorage until this value is changed. You can specify:
    //   - "delta" to enable over-the-air delta update for this file
    //   - "full" means full update will be made when this file changes
    "update": "full"
}

禁用 extjs 中的缓存,以便浏览器从服务器获取数据.为此,请添加以下 app.json 文件.

Disable the cache in extjs so browser will get data from server. To do that, add the following app.json file.

"production": {
    "cache": {
        "enable": false
    }
}

"css": [
    {
        // this entry uses an ant variable that is the calculated
        // value of the generated output css file for the app,
        // defined in .sencha/app/defaults.properties
        "path": "${build.out.css.path}",
        "bundle": true,
        "update": "full"
    }
],

这篇关于禁用 ExtJs 应用程序的缓存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆