Go to the documentation of this file.00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00015 abstract class OptimizerSegmentHandler implements SegmentHandler
00016 {
00017 protected $id = null;
00018 protected $locker = null;
00019
00020 abstract protected function getMap();
00021 abstract protected function storeMap(array $map);
00022
00023 public function __construct($segmentId)
00024 {
00025 $this->id = $segmentId;
00026 }
00027
00028 public function touch($key)
00029 {
00030 $map = $this->getMap();
00031
00032 if (!isset($map[$key])) {
00033 $map[$key] = true;
00034 return $this->storeMap($map);
00035 }
00036
00037 $this->locker->free($this->id);
00038 return true;
00039 }
00040
00041 public function unlink($key)
00042 {
00043 $map = $this->getMap();
00044
00045 if (isset($map[$key])) {
00046 unset($map[$key]);
00047 return $this->storeMap($map);
00048 }
00049
00050 $this->locker->free($this->id);
00051 return true;
00052 }
00053
00054 public function ping($key)
00055 {
00056 $map = $this->getMap();
00057
00058 $this->locker->free($this->id);
00059
00060 if (isset($map[$key])) {
00061 return true;
00062 } else {
00063 return false;
00064 }
00065 }
00066 }
00067 ?>