Skip to content

Commit 237b26d

Browse files
committed
Use '/' for slash. This breaks full-psr6 compliance but allows to have hierarchical cache.
1 parent e140e67 commit 237b26d

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

src/Charcoal/Model/Service/MetadataLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ public function load($ident, MetadataInterface $metadata, array $interfaces = nu
271271
$interfaces = null;
272272
}
273273

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

277277
if (!$cacheItem->isHit()) {

src/Charcoal/Model/Service/ModelLoader.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,13 +165,12 @@ public function load($ident, $useCache = true)
165165
// Do not use cache;
166166
return $this->loadFromSource($ident);
167167
}
168-
$cacheKey = str_replace('/', '.', 'model/loader/'.$this->objType.'/'.$ident);
168+
$cacheKey = 'objects/'.str_replace('/', '.', $this->objType.'.'.$ident);
169169
$cacheItem = $this->cachePool->getItem($cacheKey);
170170

171171
$obj = $cacheItem->get();
172172
if (!$cacheItem->isHit()) {
173173
$obj = $this->loadFromSource($ident);
174-
175174
$this->cachePool->save($cacheItem->set($obj));
176175
}
177176
return $obj;

0 commit comments

Comments
 (0)