Path: blob/master/src/applications/diviner/cache/DivinerPublishCache.php
12256 views
<?php12final class DivinerPublishCache extends DivinerDiskCache {34private $pathMap;5private $index;67public function __construct($cache_directory) {8parent::__construct($cache_directory, 'diviner-publish-cache');9}101112/* -( Path Map )----------------------------------------------------------- */131415public function getPathMap() {16if ($this->pathMap === null) {17$this->pathMap = $this->getCache()->getKey('path', array());18}19return $this->pathMap;20}2122public function writePathMap() {23$this->getCache()->setKey('path', $this->getPathMap());24}2526public function getAtomPathsFromCache($hash) {27return idx($this->getPathMap(), $hash, array());28}2930public function removeAtomPathsFromCache($hash) {31$map = $this->getPathMap();32unset($map[$hash]);33$this->pathMap = $map;34return $this;35}3637public function addAtomPathsToCache($hash, array $paths) {38$map = $this->getPathMap();39$map[$hash] = $paths;40$this->pathMap = $map;41return $this;42}434445/* -( Index )-------------------------------------------------------------- */464748public function getIndex() {49if ($this->index === null) {50$this->index = $this->getCache()->getKey('index', array());51}52return $this->index;53}5455public function writeIndex() {56$this->getCache()->setKey('index', $this->getIndex());57}5859public function deleteAtomFromIndex($hash) {60$index = $this->getIndex();61unset($index[$hash]);62$this->index = $index;63return $this;64}6566public function addAtomToIndex($hash, array $data) {67$index = $this->getIndex();68$index[$hash] = $data;69$this->index = $index;70return $this;71}7273}747576