PHP Classes

Cache Master: Store and retrieve data in cache files

Recommend this page to a friend!
  Info   View files Example   View files View files (2)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 452 All time: 6,149 This week: 191Up
Version License PHP version Categories
cache-master 3Freely Distributable5Cache


This class can store and retrieve data in cache files.

The class can store given data with a given key in cache file under a given cache directory. The cache directory is created if it does not exist.

The class stores the cache data in a file and the cache metadata in another file that holds the cache expiry time.

The class can also check if the cache file exists and retrieve the stored data, check if the cache file expired, or remove existing cache files.

Picture of Anthony Amolochitis
  Performance   Level  
Name: Anthony Amolochitis <contact>
Classes: 10 packages by
Country: United States United States
Age: 44
All time rank: 1138166 in United States United States
Week rank: 368 Up43 in United States United States Up


What is the best PHP page caching class?
Need best caching to store XML documents


$someData = new stdClass();
$someData->oneItem = 'One Item';
$someData->twoItem = 'Two Item';
$someData->threeItem = 'Three Item';

$jsonEncodedData = json_encode($someData);
$key = 'SomeUniqueId';
$customDirectory = '/tmp/customDirectory/';

 * Cache it
$CachedMaster = new CacheMaster();
$CachedMaster->put($key, $jsonEncodedData);

 * Load it
if( $CacheMaster->exists($key) )
    $x = json_decode( $CacheMaster->get($key), true);
    echo '<pre>';
    echo '</pre>';

  Files folder image Files  
File Role Description
Plain text file CacheMaster.php Class Simple Cache Utility
Plain text file Example.php Example Example Usage

 Version Control Unique User Downloads Download Rankings  
This week:0
All time:6,149
This week:191Up