00001 <?php 00024 class CacheFactory extends BaseFactory { 00028 private static $selfInstance = null; 00029 00035 protected function __construct () { 00036 // Call parent constructor 00037 parent::__construct(__CLASS__); 00038 } 00039 00045 public final static function getFactory () { 00046 // Is the instance null? 00047 if (is_null(self::$selfInstance)) { 00048 // Set a new one 00049 self::$selfInstance = new CacheFactory(); 00050 } 00051 00052 // Return the instance 00053 return self::$selfInstance; 00054 } 00055 00061 public function createConfiguredCache () { 00062 // Read the config entry 00063 $cacheType = $this->getConfigInstance()->readConfig('cache_class'); 00064 00065 // And get a new instance 00066 $cacheInstance = ObjectFactory::createObjectByName($cacheType); 00067 00068 // Return the instance 00069 return $cacheInstance; 00070 } 00071 } 00072 00073 // [EOF] 00074 ?>
1.5.6