.js file removed from cache before expiry date

S

SleeplessAndy

Hi,


We have a site with some .js files that due to size/wan speed we want
to stay cached. Why could they be sticking around for about 10
different document loads, accessing the file, browsing away to other
pages, then back to similar docs using the file again, thenn suddenly
it gets deleted. The IE cache is set for testing to 5mb, and the file
sticks around, even though the cache continually goes up to this limit
and above, and other files are replaced. Then suddenly, a page load
will cause the large .js file to be removed, even though the expiry is
30 days in the future.

I don't understand. Any help gratefully received!

thanks

Andy
 
R

Richard Cornford

Hi,

We have a site with some .js files that due to size/wan speed
we want to stay cached. Why could they be sticking around
for about 10 different document loads, accessing the file,
browsing away to other pages, then back to similar docs using
the file again, thenn suddenly it gets deleted. The IE cache
is set for testing to 5mb, and the file sticks around, even
though the cache continually goes up to this limit and above,
and other files are replaced. Then suddenly, a page load
will cause the large .js file to be removed, even though
the expiry is 30 days in the future.

I don't understand. Any help gratefully received!

I don't know what you expect anyone to say about this. Caching is non-
mandatory and the rules that do apply to it may say a browser
shouldn't use a cached resource after it expires but they don't say
that it must not re-request a cached resource prior to its expiring.

The details of what IE is doing will be in the source code and/or
development documentation for the browser, so not available to anyone
outside Microsoft.

Richard.
 
S

SleeplessAndy

On Jun 4, 12:48 pm, SleeplessAndy wrote:

I don't know what you expect anyone to say about this. Caching is non-
mandatory and the rules that do apply to it may say a browser
shouldn't use a cached resource after it expires but they don't say
that it must not re-request a cached resource prior to its expiring.

The details of what IE is doing will be in the source code and/or
development documentation for the browser, so not available to anyone
outside Microsoft.

Richard.

Ummm.. I didn't really 'expect' anyone to say anything in particular,
but perhaps offer some sort of reason why we are seeing this
behaviour. It isn't performing the same, it's apparently "random" but
this can't be the case.

The file is being deleted during an unrelated page load before it
expires, which is why it's being re-requested. Sometimes. It can
stay in the cache for 3 hours, 50 page loads, the go, then stay for 5
page loads, then go again.

I'm actually hoping for a onle line "Its this .... causing " really.
Fingers crossed.
 
D

Dan

SleeplessAndy said:
Hi,


We have a site with some .js files that due to size/wan speed we want
to stay cached. Why could they be sticking around for about 10
different document loads, accessing the file, browsing away to other
pages, then back to similar docs using the file again, thenn suddenly
it gets deleted. The IE cache is set for testing to 5mb, and the file
sticks around, even though the cache continually goes up to this limit
and above, and other files are replaced. Then suddenly, a page load
will cause the large .js file to be removed, even though the expiry is
30 days in the future.

I don't understand. Any help gratefully received!

thanks

Andy

If it's IE that is expiring this file, then that's an IE issue, not IIS,
assuming that IIS is sending the correct headers. Have you checked with
Fiddler2 or a similar tracing tool to see what the headers look like?
 
S

SleeplessAndy

If it's IE that is expiring this file, then that's an IE issue, not IIS,
assuming that IIS is sending the correct headers. Have you checked with
Fiddler2 or a similar tracing tool to see what the headers look like?

You are right Dan, I posted this in here because I saw a similar(ish)
question when I searched for a solution. I'll repost in the correct
grou, but thanks for the tip, I'll follow that too. :)
 
T

Thomas 'PointedEars' Lahn

SleeplessAndy said:
We have a site with some .js files that due to size/wan speed we want
to stay cached. Why could they be sticking around for about 10
different document loads, accessing the file, browsing away to other
pages, then back to similar docs using the file again, thenn suddenly
it gets deleted. The IE cache is set for testing to 5mb, and the file
sticks around, even though the cache continually goes up to this limit
and above, and other files are replaced. Then suddenly, a page load
will cause the large .js file to be removed, even though the expiry is
30 days in the future.

I don't understand. Any help gratefully received!

The problem might have to do with the way you load the ".js files". Not
understanding how HTTP caching works has led many people to believe that
using a variant query-part when referring to resources would be a proper
solution, e.g.:

document.write('<script type="text/javascript" src="foo.js?'
+ (+new Date()) + '"><\/script>');

Of course, this means that a HTTP client regards every such resource a
single entity, which fills HTTP caches much faster than if the recommended
method, cache control¹, would have been used (for example, it would take
only 10 reloads of a cached HTML document including 5 script resources of
100 kB size each until a cache of 5 MB size was full²). As a result, other,
especially larger resources need to be removed from the cache earlier if the
policy is that the cache size should not exceed a certain limit.

However, I recommend to set the IE cache size to something between 20 and
100 "MB". (42 works for me, of course ;-))

That said, in my experience IE's caching mechanism, at least in IE 6.0 and
7.0, appeared to be borken in several places.

It is difficult to see why you would post this problem to a newsgroup
dealing with Internet Information Server/Services, and another one dealing
with ECMAScript-based script programming, instead of to one dealing
specifically with Microsoft Internet Explorer.

You should also be aware that Microsoft has announced that beginning in June
2010, they would begin closing their newsgroups, so it might not be the best
idea to use the microsoft.* hierarchy anymore.³

<http://www.catb.org/~esr/faqs/smart-questions.html>


F'up2 cljs

PointedEars
___________
¹ <http://www.mnot.net/cache_docs/>
² For simplicity, I am using SI units here (I do not know what IE uses):
1 MB = 1000 kB = 1'000'000 bytes (but 1 MiB = 1024 KiB = 1'048'576 bytes)
³ <http://www.microsoft.com/communities/newsgroups/default.mspx>
 
D

Dr J R Stockton

In comp.lang.javascript message <[email protected]>,
You should also be aware that Microsoft has announced that beginning in June
2010, they would begin closing their newsgroups, so it might not be the best
idea to use the microsoft.* hierarchy anymore.³


Microsoft will be removing the groups from their servers and perhaps
issuing 'rmgroup' messages. News server administrators will honour or
disregard those messages as they see fit. I doubt, for example, whether
Google will do so; they compete with Microsoft. It should raise the
average intelligence in those groups noticeably.

The intelligent move, therefore, is to continue to use those groups
while being aware that the Microsoft adulators will no longer be
present.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top