Skip to content

Forces browsers to re-download your updated files. Helps with clients & visitors not seeing updates/changes.

Notifications You must be signed in to change notification settings

AndrewChamp/Simple-File-Cache-Updating

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 

Repository files navigation

Simple File Cache Updating

Have aggressive caching on your server or framework? Have issues with clients seeing changes when you update a file or image? Well, you're in luck! Prevent aggressive browser cachinbg with this class.

Just instantiate the class and wrap your files with the method. Like magic!

$cache = new cache(__DIR__);
<!-- Example -->
<link rel="stylesheet" href="<?=$cache->file('/styles/main.css');?>" />

The output will look something like this...

<link rel="stylesheet" href="/styles/main.css?version=1476374736" />

Now everytime you edit/update your file or image it will grab the file's filemtime and append it to the end of the file with a query string, assuring you that the browser will download the "new file" anytime it's updated.

So damn good that you'll say, "Thanks Obama".

About

Forces browsers to re-download your updated files. Helps with clients & visitors not seeing updates/changes.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages