Link to home
Start Free TrialLog in
Avatar of Camillia
CamilliaFlag for United States of America

asked on

Howcome I don't have to clear cache when I move code to production?

I've had this question for a while now...

When I make changes to JS/jQuery code and run the code locally on my laptop, I sometimes need to clear the cache to see the changes.

I have both minified and non-minified version of JS files.

When I move the code to our Production, I don't ask the users to clear their cache.

Howcome users don't have to clear their cache when I move code to Production? why do I need to clear cache only when I'm developing?
Avatar of Dr. Klahn
Dr. Klahn

When the users' systems are powered up in the morning and also when their browsers are started from scratch at the beginning of the day, their browser caches will be clear.  The issue can't occur in this situation.
ASKER CERTIFIED SOLUTION
Avatar of Julian Hansen
Julian Hansen
Flag of South Africa image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Camillia

ASKER

Thanks, guys.

First question is: how do you know they don't have to clear their cache?
Yes, I don't know for sure.

Question

Cached JS / CSS is a common problem which is why many systems work on a principle of versioning their scripts / stylesheets by adding a parameter to the URL
?ver=123
or ?ver=time()

How would versioning help in clearing the cache?
I must respectfully disagree with Julian's comment regarding browsers and cache.  Every browser I have encountered starts up with nothing in its cache, and builds the cache as it continues running.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
if you have cleared the cache
If you clear your cache the problem goes away - irrespective of whether you restart the browser or not.
Thanks. Let me read.
Thanks. I have another question but I'll open another thread. This helped a lot.