PHP Classes

Class Cache: Caching data in files of a given folder

Recommend this page to a friend!
     
  Info   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStar 45%Total: 1,523 All time: 2,571 This week: 488Up
Version License Categories
class_cache 1.0GNU General Publi...Files and Folders, Cache
Description 

Author

This class is capable of caching arbitrary data in files of a given folder.

This is meant to help reducing the time it takes to serve the same content of pages that would take a long time to generate and would slow down the access to such pages if they had to regenerated everytime when not using content caching.

The class works by checking if a cache file with a given key exists and it was not created since a longer time than the cache expiration period. If it does not exist or has expired, the data is stored in a cache file. Otherwise the data is retrieved from the cache file.

The class uses the MD5 algorithm to generate the names of the files on which the cached data is stored.

If the folder where the cache files are created does not exist, the class can create it and also store in them an empty index.html file and a .htaccess file with permissions set to deny access to the files via the Web in case you are using Apache as Web server.

The default cache expiry time is 86400 seconds. The default cache folder is the ./cache. You can change these values when the cache class object is created using the class constructor of ant time later the updateCache function.

Picture of MARY Matthieu
Name: MARY Matthieu <contact>
Classes: 19 packages by
Country: France, Metropolitan
Age: 45
All time rank: 251 in France, Metropolitan
Week rank: 164 Down1 in France, Metropolitan Equal

  Files folder image Files (2)  
File Role Description
Accessible without login Plain text file CHANGELOG Data changelog file
Plain text file class_cache.php Class This class_cache file

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 0%
Total:1,523
This week:0
All time:2,571
This week:488Up
 User Ratings  
 
 All time
Utility:75%StarStarStarStar
Consistency:75%StarStarStarStar
Documentation:-
Examples:-
Tests:-
Videos:-
Overall:45%StarStarStar
Rank:3365