Skip to content

Commit dcbddf3

Browse files
author
Ant Brown
committed
Only cache terms that exist (Islandora#2272)
1 parent 579e056 commit dcbddf3

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

src/IslandoraUtils.php

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -311,15 +311,14 @@ public function getTermForUri($uri) {
311311
if (!empty($results)) {
312312
$term = $this->entityTypeManager->getStorage('taxonomy_term')
313313
->load(reset($results));
314+
$this->cache->set(
315+
$cid,
316+
$term,
317+
CacheBackendInterface::CACHE_PERMANENT,
318+
Cache::mergeTags(array_merge($term->getCacheTags(), ['user:' . $this->currentUser->id()]))
319+
);
314320
}
315321

316-
$this->cache->set(
317-
$cid,
318-
$term,
319-
CacheBackendInterface::CACHE_PERMANENT,
320-
Cache::mergeTags(array_merge($term->getCacheTags(), ['user:' . $this->currentUser->id()]))
321-
);
322-
323322
return $term;
324323
}
325324

0 commit comments

Comments
 (0)