Instantiation

To instantiate a cache object, you use the Solar_Cache factory class to pick which adapter you want. In the following example, we'll set up a file adapter cache (which stores data as a file on the hard drive).

<?php
require_once 'Solar.php';
Solar::start('/path/to/config/Solar.config.php');

// set up the cache options
$config = array(
    // which adapter class to use
    'adapter' => 'Solar_Cache_Adapter_File',

    // where the cache files will be stored
    'path' => '/tmp/Solar_Cache/',

    // the cache entry lifetime in seconds
    'life' => 1800,
);

// create a cache object
$cache = Solar::factory('Solar_Cache', $config);
?>