[ Index ] |
PHP Cross Reference of Phabricator |
[Summary view] [Print] [Text view]
1 <?php 2 3 final class DivinerPublishCache extends DivinerDiskCache { 4 5 private $pathMap; 6 private $index; 7 8 public function __construct($cache_directory) { 9 return parent::__construct($cache_directory, 'diviner-publish-cache'); 10 } 11 12 13 /* -( Path Map )----------------------------------------------------------- */ 14 15 16 public function getPathMap() { 17 if ($this->pathMap === null) { 18 $this->pathMap = $this->getCache()->getKey('path', array()); 19 } 20 return $this->pathMap; 21 } 22 23 public function writePathMap() { 24 $this->getCache()->setKey('path', $this->getPathMap()); 25 } 26 27 public function getAtomPathsFromCache($hash) { 28 return idx($this->getPathMap(), $hash, array()); 29 } 30 31 public function removeAtomPathsFromCache($hash) { 32 $map = $this->getPathMap(); 33 unset($map[$hash]); 34 $this->pathMap = $map; 35 return $this; 36 } 37 38 public function addAtomPathsToCache($hash, array $paths) { 39 $map = $this->getPathMap(); 40 $map[$hash] = $paths; 41 $this->pathMap = $map; 42 return $this; 43 } 44 45 46 /* -( Index )-------------------------------------------------------------- */ 47 48 public function getIndex() { 49 if ($this->index === null) { 50 $this->index = $this->getCache()->getKey('index', array()); 51 } 52 return $this->index; 53 } 54 55 public function writeIndex() { 56 $this->getCache()->setKey('index', $this->getIndex()); 57 } 58 59 public function deleteAtomFromIndex($hash) { 60 $index = $this->getIndex(); 61 unset($index[$hash]); 62 $this->index = $index; 63 return $this; 64 } 65 66 public function addAtomToIndex($hash, array $data) { 67 $index = $this->getIndex(); 68 $index[$hash] = $data; 69 $this->index = $index; 70 return $this; 71 } 72 73 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Sun Nov 30 09:20:46 2014 | Cross-referenced by PHPXref 0.7.1 |