Cache : how to clear cache






Cache : 


What is cache :- 


Tt is a file or page stored in a browser when you visited website.

Advantage :-

  Its decrease the loading time of any page. because its file stored in your browser when first time u visited website. Till your browser removes it cache.

Disadvantage : -

 Sometimes when you publish new post , it will not shown to users who already visited website and its stored in cache, till there cache not update or deleted previous cache file.

Now how resolve thi issue:- for developer 

Already tested 

some header you can put in website it can remove the cache of your website in browser and always how the updated file 



header("Cache-Control: no-cache, must-revalidate"); // if always wanted to update use this
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");

Php users  put this any of this code in php tag

<?php
header("Expires: Tue, 01 Jan 2000 00:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
?>


Try using the HTML cache control META TAGS:
<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
<META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">
or use EXPIRES:
<META HTTP-EQUIV="EXPIRES" CONTENT="Mon, 02 May 2015 21:00:00 GMT">
   



Comments

Post a Comment