Source for file Memory.php

Documentation is available at Memory.php

  1. <?php
  2.  
  3. /**
  4.  * Definition cache decorator class that saves all cache retrievals
  5.  * to PHP's memory; good for unit tests or circumstances where
  6.  * there are lots of configuration objects floating around.
  7.  */
  8. {
  9.     
  10.     protected $definitions;
  11.     public $name = 'Memory';
  12.     
  13.     public function copy({
  14.         return new HTMLPurifier_DefinitionCache_Decorator_Memory();
  15.     }
  16.     
  17.     public function add($def$config{
  18.         $status parent::add($def$config);
  19.         if ($status$this->definitions[$this->generateKey($config)$def;
  20.         return $status;
  21.     }
  22.     
  23.     public function set($def$config{
  24.         $status parent::set($def$config);
  25.         if ($status$this->definitions[$this->generateKey($config)$def;
  26.         return $status;
  27.     }
  28.     
  29.     public function replace($def$config{
  30.         $status parent::replace($def$config);
  31.         if ($status$this->definitions[$this->generateKey($config)$def;
  32.         return $status;
  33.     }
  34.     
  35.     public function get($config{
  36.         $key $this->generateKey($config);
  37.         if (isset($this->definitions[$key])) return $this->definitions[$key];
  38.         $this->definitions[$keyparent::get($config);
  39.         return $this->definitions[$key];
  40.     }
  41.     
  42. }

Documentation generated on Thu, 19 Jun 2008 18:49:47 -0400 by phpDocumentor 1.4.2