I am developing product in language HTML CSS and AngularJS and Api are written in JAVA.Whenever their is update in any functionality I need to clear cache then only changes are reflected, clearing cache is not feasible solution.
-
1_"Whenever their is update in any functionality i need to clear cache then only changes are reflected,clearing cache is not feasible solution."_? What are you trying to achieve? – guest271314 Jan 22 '17 at 07:06
-
Better solution than clearing cache each time to see changes – Shubham Khandelwal Jan 22 '17 at 07:42
-
What changes are being made to `document`? – guest271314 Jan 22 '17 at 07:50
-
Spring has a live reload option so if you use that - check it out. Are you testing with Chrome? You can disable caching in the developer tools. – Muli Yulzary Jan 22 '17 at 08:00
2 Answers
As you the problem is with browser cache, so you can implement cache busting. Main idea behind cache busting is
- When browser asks for a particular .js/.css/.html file, you need to provide new files with different name.
- So that browser will request for new files next time and now caching is gone.
- Go through this implementation - Same problem as yours
-
I don't think changing names of file each time will work for me because their is lot of dependencies in my code structure – Shubham Khandelwal Jan 22 '17 at 07:28
-
@ShubhamKhandelwal I've provided a link above in 3rd point, go through it. I'm positive that will help. – psycho Jan 27 '17 at 09:20
I was faced with similar problem in development. Here're few solutions I came across.
You could use incognito
tab in development environment. This would automatically clear the cache with every new tab. One drawback is that you'll have to login or navigate to needed page.
Another solution used was clearing cache by JavaScript. Here versioning is used to identify whether new change occurred. If the version number is changed script would be run to clear browser cache. This is a separate task and should be changed differently for different browsers. However this would slow down website performance.
This is useful in production envirnoment rather than in development. Simply because we cant ask users to clear cache or use incognito everytime.

- 503
- 1
- 6
- 16