Login   Register  
PHP Classes
elePHPant
Icontem

Class Cache: Caching data in files of a given folder

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Info   View files View files (2)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings  
2004-02-19 (10 years ago) RSS 2.0 feedStarStarStar 49%Total: 1,503 All time: 2,401 This week: 1,485Up
Version License Categories  
class_cache 1.0GNU General Public Lice...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 France, Metropolitan
Age: 35
All time rank: 241 in France, Metropolitan France, Metropolitan
Week rank: 302 Down1 in France, Metropolitan France, Metropolitan Equal

  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,503All time:2,401
 This week:0This week:1,485Up
 User Ratings  
 
 All time
Utility:83%StarStarStarStarStar
Consistency:83%StarStarStarStarStar
Documentation:-
Examples:-
Tests:-
Videos:-
Overall:49%StarStarStar
Rank:1611