/** * {@inheritDoc} */ public function getNode($path) { if (empty($this->caches['nodes'])) { return parent::getNode($path); } $this->assertLoggedIn(); $cacheKey = "nodes: {$path}, " . $this->workspaceName; $cacheKey = $this->sanitizeKey($cacheKey); if (false !== ($result = $this->caches['nodes']->fetch($cacheKey))) { if ('ItemNotFoundException' === $result) { throw new ItemNotFoundException(sprintf('Item "%s" not found in workspace "%s"', $path, $this->workspaceName)); } return $result; } try { $node = parent::getNode($path); } catch (ItemNotFoundException $e) { if (isset($this->caches['nodes'])) { $this->caches['nodes']->save($cacheKey, 'ItemNotFoundException'); } throw $e; } $this->caches['nodes']->save($cacheKey, $node); return $node; }
/** * {@inheritDoc} */ public function getNode($path) { $this->assertLoggedIn(); $cacheKey = "nodes: {$path}, " . $this->workspaceName; if (isset($this->caches['nodes']) && false !== ($result = $this->caches['nodes']->fetch($cacheKey))) { return $result; } $node = parent::getNode($path); if (isset($this->caches['nodes'])) { $this->caches['nodes']->save($cacheKey, $node); } return $node; }