-
Notifications
You must be signed in to change notification settings - Fork 4
Home
brianhaveri edited this page Sep 14, 2010
·
6 revisions
MiniCache is a small, lightweight PHP5 cache system made for novice to intermediate developers, or skilled developers that don’t demand the full feature set of memcached or APC.
- You are dynamically generating HTML strings, but it can be slow and hinder performance. You can use MiniCache to store
the generated HTML string. - You want to save the state of a PHP object. MiniCache can save the entire object for later reuse.
- You want to parse data from multiple sources into a PHP array. MiniCache can act as a central data storage location, keeping your memory footprint lower.
- Set cache directory
- Open MiniCache.php and edit line 23 to an absolute path that exists on your system. Example:
private $_path = '/myproject/cache/'; // Path MUST exist, be writeable, and include trailing slash
require('MiniCache.php');
$data = array('red', 'blue'); // Sample data. You can store any datatype (array, object, string, etc.)
$mc = MiniCache::getInstance();
$mc->set('colors', $data);
print_r($mc->get('colors')); // Array( [0]=> red, [1] => blue )