00001 <?php 00024 class MemoryCache extends BaseFrameworkSystem implements Cacheable { 00028 private $dataCache = null; 00029 00035 protected function __construct () { 00036 // Call parent constructor 00037 parent::__construct(__CLASS__); 00038 00039 // Clean up a little 00040 $this->removeNumberFormaters(); 00041 $this->removeSystemArray(); 00042 } 00043 00049 public final static function createMemoryCache () { 00050 // Get a new instance 00051 $cacheInstance = new MemoryCache(); 00052 00053 // Initialize the cache 00054 $cacheInstance->initCache(); 00055 00056 // Return the prepared instance 00057 return $cacheInstance; 00058 } 00059 00065 protected function initCache () { 00066 // Now create the "data cache" 00067 $this->dataCache = new FrameworkArrayObject('FakedDataCache'); 00068 } 00069 00076 public final function offsetExists ($offset) { 00077 $exists = $this->dataCache->offsetExists($offset); 00078 return $exists; 00079 } 00080 00088 public final function offsetSet ($offset, $data) { 00089 $this->dataCache->offsetSet($offset, $data); 00090 } 00091 00098 public final function offsetGet ($offset) { 00099 // Default is offset not found 00100 $data = null; 00101 00102 // Is the offset there? 00103 if ($this->offsetExists($offset)) { 00104 // Then get the data from it 00105 $data = $this->dataCache->offsetGet($offset); 00106 } 00107 00108 // Return data 00109 return $data; 00110 } 00111 } 00112 00113 // [EOF] 00114 ?>
1.5.6