Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm trying to develop a strategy to handle cached javascript files, css, images, etc when we release an update to our site. Before I get into implementing version numbers on the javascript files I was wondering if an IIS reset after each release would effectively cause cached files to be resent.

share|improve this question

3 Answers 3

up vote 3 down vote accepted

When you do an IISReset the IIS cache will be cleared and then will start to be rebuilt after it starts back up as client requests come in. If you update a file then the older cached file will become stale and IIS will serve the updated file and update the cache with the new file.

IISReset (although harsh) will clear the IIS cache but it won't do anything with local caches in proxies or clients. Maybe you've just got the terminology mixed up a bit, but there isn't any concept of "resent" when it comes to caching. It's all request based. If a client requests something and it's found in a cache then it'll get served from the cache. You'll need to force content expiration on your files if you will be maintaining the same filenames.

share|improve this answer
    
Thanks for the help. Please forgive my ignorance in this area ... I'm getting confused between the client and IIS cache. The term 'resent' was to refer to the server sending the content rather than it being pulled from the client's cache. –  DaveK Sep 1 '10 at 16:18
    
@Dave no worries at all, glad it helped! One additional bit, if a file is located in a client cache or an upstream proxy cache then the server won't even receive the request unless the cached item is stale and there's a newer version available from the server. –  squillman Sep 1 '10 at 16:35

No, client caching is based on content expiration time.

share|improve this answer

When you modify one javascript file, you need ALL clients what are running the web application to get the new file, it is clear to me the "recent".

For each client to get from the server the new file, you only need to include in the include/script of your javascript in the web page the "?version=1".

It is only necessary one parameter could be ?blue=hello or ?v=1234155 it is like you want. The importance is use a different value each time you change the javascript. "?version=1" for first change, "?version=2" for second change, it is practical and single to know the next value. Also you can use a GUID if you want : "?version=4747b320-62ce-11cf-a5d6-28db04c10777" or you can use the date and time "?version=20130220175025" for 2013/02/20 17:50:25.

Example #1

<script type="text/javascript" src="http//..../jquery/1.7.1/jquery.min.js?version=1"></script>

Example #2

<script type="text/javascript" src="http//..../jquery/1.7.1/jquery.min.js?k=4747b320-62ce-11cf-a5d6-28db04c10777"></script>
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.