Skip to content

Commit

Permalink
Use '/' for slash. This breaks full-psr6 compliance but allows to hav…
Browse files Browse the repository at this point in the history
…e hierarchical cache.
  • Loading branch information
mducharme committed Feb 15, 2017
1 parent e140e67 commit 237b26d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Charcoal/Model/Service/MetadataLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ public function load($ident, MetadataInterface $metadata, array $interfaces = nu
$interfaces = null;
}

$cacheKey = str_replace('/', '.', 'metadata/object/'.$ident);
$cacheKey = 'metadata/'.str_replace('/', '.', $ident);
$cacheItem = $this->cachePool()->getItem($cacheKey);

if (!$cacheItem->isHit()) {
Expand Down
3 changes: 1 addition & 2 deletions src/Charcoal/Model/Service/ModelLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -165,13 +165,12 @@ public function load($ident, $useCache = true)
// Do not use cache;
return $this->loadFromSource($ident);
}
$cacheKey = str_replace('/', '.', 'model/loader/'.$this->objType.'/'.$ident);
$cacheKey = 'objects/'.str_replace('/', '.', $this->objType.'.'.$ident);
$cacheItem = $this->cachePool->getItem($cacheKey);

$obj = $cacheItem->get();
if (!$cacheItem->isHit()) {
$obj = $this->loadFromSource($ident);

$this->cachePool->save($cacheItem->set($obj));
}
return $obj;
Expand Down

0 comments on commit 237b26d

Please sign in to comment.