00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00020 final class ReferencePool extends SelectivePeer
00021 {
00022 private $peer = null;
00023 private $pool = array();
00024
00025 public function __construct(CachePeer $peer)
00026 {
00027 $this->peer = $peer;
00028 }
00029
00033 public function mark($className)
00034 {
00035 $this->peer->mark($className);
00036
00037 return $this;
00038 }
00039
00040 public function get($key)
00041 {
00042 if (isset($this->pool[$key]) && $this->pool[$key])
00043 return $this->pool[$key];
00044
00045 return $this->pool[$key] = $this->peer->get($key);
00046 }
00047
00048 public function delete($key)
00049 {
00050 unset($this->pool[$key]);
00051
00052 return $this->peer->delete($key);
00053 }
00054
00058 public function clean()
00059 {
00060 $this->pool = array();
00061
00062 return $this->peer->clean();
00063 }
00064
00065 public function isAlive()
00066 {
00067 return $this->peer->isAlive();
00068 }
00069
00070 protected function store(
00071 $action, $key, &$value, $expires = Cache::EXPIRES_MEDIUM
00072 )
00073 {
00074 $this->pool[$key] = $value;
00075
00076 return $this->peer->$action($key, $value, $expires);
00077 }
00078 }
00079 ?>