9     protected $caches = array(
'Serializer' => array());
    23     public static function instance($prototype = null) {
    25         if ($prototype !== null) {
    26             $instance = $prototype;
    27         } elseif ($instance === null || $prototype === 
true) {
    39     public function register($short, $long) {
    40         $this->implementations[$short] = $long;
    48     public function create($type, $config) {
    49         $method = $config->get(
'Cache.DefinitionImpl');
    50         if ($method === null) {
    53         if (!empty($this->caches[$method][$type])) {
    54             return $this->caches[$method][$type];
    57           isset($this->implementations[$method]) &&
    58           class_exists($class = $this->implementations[$method], 
false)
    60             $cache = 
new $class($type);
    62             if ($method != 
'Serializer') {
    63                 trigger_error(
"Unrecognized DefinitionCache $method, using Serializer instead", E_USER_WARNING);
    67         foreach ($this->decorators as $decorator) {
    68             $new_cache = $decorator->decorate($cache);
    73         $this->caches[$method][$type] = $cache;
    74         return $this->caches[$method][$type];
    82         if (is_string($decorator)) {
    83             $class = 
"HTMLPurifier_DefinitionCache_Decorator_$decorator";
    84             $decorator = 
new $class;
    86         $this->decorators[$decorator->name] = $decorator;
 addDecorator($decorator)
Registers a decorator to add to all new cache objects. 
 
setup()
Initialize default decorators. 
 
create($type, $config)
Factory method that creates a cache object based on configuration. 
 
static instance($prototype=null)
Retrieves an instance of global definition cache factory. 
 
Null cache object to use when no caching is on. 
 
Responsible for creating definition caches.