3 final class DivinerPublishCache
extends DivinerDiskCache
{
8 public function __construct($cache_directory) {
9 parent
::__construct($cache_directory, 'diviner-publish-cache');
13 /* -( Path Map )----------------------------------------------------------- */
16 public function getPathMap() {
17 if ($this->pathMap
=== null) {
18 $this->pathMap
= $this->getCache()->getKey('path', array());
20 return $this->pathMap
;
23 public function writePathMap() {
24 $this->getCache()->setKey('path', $this->getPathMap());
27 public function getAtomPathsFromCache($hash) {
28 return idx($this->getPathMap(), $hash, array());
31 public function removeAtomPathsFromCache($hash) {
32 $map = $this->getPathMap();
34 $this->pathMap
= $map;
38 public function addAtomPathsToCache($hash, array $paths) {
39 $map = $this->getPathMap();
41 $this->pathMap
= $map;
46 /* -( Index )-------------------------------------------------------------- */
49 public function getIndex() {
50 if ($this->index
=== null) {
51 $this->index
= $this->getCache()->getKey('index', array());
56 public function writeIndex() {
57 $this->getCache()->setKey('index', $this->getIndex());
60 public function deleteAtomFromIndex($hash) {
61 $index = $this->getIndex();
63 $this->index
= $index;
67 public function addAtomToIndex($hash, array $data) {
68 $index = $this->getIndex();
69 $index[$hash] = $data;
70 $this->index
= $index;