prefix = $name; } public function store($key, $value) { return @apc_store($this->storageKey($key), $value); } public function fetch($key) { return @apc_fetch($this->storageKey($key)); } public function delete($key) { return @apc_delete($this->storageKey($key)); } public function isLocked($key) { if ((@apc_fetch($this->storageKey($key) . '.lock')) === false) { return false; } return true; } public function lock($key) { // the interesting thing is that this could fail if the lock was created in the meantime.. // but we'll ignore that out of convenience @apc_add($this->storageKey($key) . '.lock', '', 5); } public function unlock($key) { // suppress all warnings, if some other process removed it that's ok too @apc_delete($this->storageKey($key) . '.lock'); } private function storageKey($key) { return $this->prefix . '_' . $key; } }