View Full Version : Is there a simple way to disable caching for an entire ExtJS 4 application?

whirling dervish
21 Feb 2013, 3:12 PM
As far as I can tell to the extra extjs disable caching parameter, I have to do the following,

Disable it on the loader,

disableCaching: false

Disable it on the Ajax singleton,

Ext.Ajax.disableCaching = false;

And then disable it on every single proxy using noCache = false.

Is there are simpler way to do all this? Ideally I'd like one thing I could set so I could easily switch between disableCaching mode being on and off.

Or at there a very least, is there a simple way to change all proxies without touch each proxy?

21 Feb 2013, 11:43 PM
Just my 2 cents, at first look there's no a global config for this, so you may override the proxy by disabling the cache trough that config - which is going to disable to all instantiated proxies in your app.
Disabling cache for Loader works only at Development, although you may need the opposite since the code you are working on changes very frequently

whirling dervish
22 Feb 2013, 5:52 AM
Hmm I am not seeing switching to ext-all.js (from ext-dev-all.js) disable the no caching param. Is that is what is suppose to happen?

22 Feb 2013, 7:14 AM
Explaining once again regarding Ext.Loader.disableCaching:
Ext.Loader manages dependency loading of files, when you do developing, For production you use Sencha Cmd which builds the app-all.js with all dependencies within it, and here playing with Ext.Loader.disableCaching is useless, you should comment that piece of code where you config Ext.Loader:

It's important to note that dynamic loading should only be used during development on your local machines. During production, all dependencies should be combined into one single JavaScript file. Ext.Loader (http://docs.sencha.com/ext-js/4-1/#!/api/Ext.Loader) makes the whole process of transitioning from / to between development / maintenance and production as easy as possible. Internally Ext.Loader.history (http://docs.sencha.com/ext-js/4-1/#!/api/Ext.Loader-property-history) maintains the list of all dependencies your application needs in the exact loading sequence. It's as simple as concatenating all files in this array into one, then include it on top of your application.

So should be sth like this:

disableCaching: true

Ext.data.Connection.disableCaching = false;
Ext.data.proxy.Server.prototype.noCache = false;
Ext.Ajax.disableCaching = false;


controllers: ["Main"],

name: 'App',

autoCreateViewport: true

Read better the docs


whirling dervish
22 Feb 2013, 7:26 AM
Ok thanks for the explanation.

Getting back to my original caching is easy to disable on the loader, but then you have disable it on Ext.Ajax and each proxy. The each proxy part bothers me the most, it is just a lot of code everywhere, granted I would probably roll it up into one constant so I can change it in the future, but it is still less the optimal.