PHP Classes

Class Cache: Caching data in files of a given folder

Recommend this page to a friend!
  Info   View files View files (2)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStar 45%Total: 1,523 This week: 1All time: 2,570 This week: 560Up
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: ???
Age: 45
All time rank: 25
Week rank: 416 Down

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

 Version Control Unique User Downloads Download Rankings  
 0%
Total:1,523
This week:1
All time:2,570
This week:560Up
 User Ratings  
 
 All time
Utility:75%StarStarStarStar
Consistency:75%StarStarStarStar
Documentation:-
Examples:-
Tests:-
Videos:-
Overall:45%StarStarStar
Rank:3312