CacheFactory

Filepath: phork/php/cache/CacheFactory.class.php

The CacheFactory loads the cache configuration and instantiates and registers the correct type of cache adaptor object based on the config. This is used in the bootstrap.


Example

//if the cache is defined as enabled in the global config
if (AppConfig::get('CacheEnabled')) {
    
    //include the cache factory class
    AppLoader::includeClass('php/cache/', 'CacheFactory');
    
    //instantiate a new factory object using the config values from the config file passed (cache.config.php)
    $objCacheFactory = new CacheFactory('cache');
    
    //register a new cache object generated by the cache factory
    AppRegistry::register('Cache', $objCacheFactory->init());
}