Caching Issue with Localhost

2

I'm trying to do some simple locally-hosted development using the Ext framework. The site is configured as a virtual directory under IIS 7, so that http://localhost/app points to the index file. The path works fine; the file loads.

Here's my problem: despite the fact that I am not making any changes to the very sizable Ext library javascript files (about 2.4 mb uncompressed), those files are being reloaded every single time I refresh the html file. Even though these files are being served off my local hard drive, each page refresh takes 12 to 13 seconds. This is making testing pretty, um, frustrating.

How can I get unchanged js files to cache? Failing that, why aren't they being loaded more quickly? I'm not downloading them off the internet, I'm moving 2 megs around on my hard drive, which I'm pretty sure should be trivial, time-wise.

Thanks!

Daniel Mason

Posted 2009-10-24T22:38:46.277

Reputation: 23

Answers

2

I'd guess that your delay isn't browser-getting-file-from-localhost-server, it's browser-interpreting-2.4mb-of-javascript. That's a lot of code to parse, and it's going to take more time than simply reading the file off the disk. I'd expect that the browser won't cache a compiled version of the file anyways, so even pulling a cached version would require re-parsing the script.

Your best bet is to optimize the .js file and strip out any functions you don't actually use (or that aren't required by the functions you do use).

quack quixote

Posted 2009-10-24T22:38:46.277

Reputation: 37 382

0

You need to put some caching directives in your script header or directly at the server level.

At the server level:

IIS7: How to set cache control for static content?

ricbax

Posted 2009-10-24T22:38:46.277

Reputation: 4 894