PHP Classes

File Cache: Store and retrieve generic data in cache files

Recommend this page to a friend!
  Info   View files View files (4)   DownloadInstall with Composer Download .zip   Reputation   Support forum (2)   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 442 All time: 6,228 This week: 377Up
Version License PHP version Categories
cache_class 1.0GNU General Publi...4.0PHP 5, Cache


This class can be used to store and retrieve generic data in cache files.

It can check if a given variable is already stored in a cache file and retrieve its value if it exists and the cache file did not expire.

Otherwise the class can create a new cache file to store a newly computed cache variable value.

Picture of Stanislav Chervenkov
Name: Stanislav Chervenkov <contact>
Classes: 1 package by
Country: Bulgaria Bulgaria
Age: ???
All time rank: 341624 in Bulgaria Bulgaria
Week rank: 667 Up6 in Bulgaria Bulgaria Up


Using the class: 1. upload the file "cache.class.php" somewhere at your server. 2. create new directory at the server and make it writable. 3. in the file where you'll use the class, include the class require_once('classes/cache.class.php'); 4. make an instance of the class $cache = new cache(); 5. setup the cache dir: $cache->cache_dir = './others/cache'; // the default is ./cache 6. follow the steps from the example (example.php).

  Files folder image Files  
File Role Description
Plain text file cache.class.php Class The main class
Accessible without login Plain text file example.php Example An example using the class
Accessible without login Plain text file README.txt Doc. README file
Accessible without login Plain text file The.GNU.General.Public.License.txt Lic. the GNU license

 Version Control Unique User Downloads Download Rankings  
This week:0
All time:6,228
This week:377Up
User Comments (2)
small class but great usability
13 years ago (Andre Luis)
Why not using the functions that PHP suggest? APC - http://www.
14 years ago (Ralf Mike Pretzlaw)