Browser Data Caching
When we send a request to web server first time, the request will be executed by server and response will be send to browser. Now the browser display the response and stores the same response in client computer as file (called cache/in hard disk). Next time when user request for the same page the browser will check for the page in cache, if found and not expired then the page will be displayed from cache, but if the page is found but expired then request will send to server. Browser data caching improves the performance.
Programmer can define the cache time 5 min, 10 min or any given time as per requirement.
We can stop the data caching using below servlet code (setting response header)
response.addDateHeader("Expires", -1);//avoid browser data caching
Cache setting can also be done in html pages as below (header section code in html page)
<meta http-equiv=”CACHE-CONTROL” content=”NO-CACHE” />
<meta http-equiv=”CACHE-CONTROL” content=”NO-STORE”/>
<meta http-equiv=”Pragma” content=”no-cache” />
<meta http-equiv=”Expires” content=”-1″ />