|
@@ 24-43 (lines=20) @@
|
| 21 |
|
/** |
| 22 |
|
* {@inheritdoc} |
| 23 |
|
*/ |
| 24 |
|
public function load($locationId, array $translations = null, bool $useAlwaysAvailable = true) |
| 25 |
|
{ |
| 26 |
|
$translationsKey = $this->getCacheTranslationKey($translations, $useAlwaysAvailable); |
| 27 |
|
$cacheItem = $this->cache->getItem("ez-location-${locationId}-${translationsKey}"); |
| 28 |
|
if ($cacheItem->isHit()) { |
| 29 |
|
return $cacheItem->get(); |
| 30 |
|
} |
| 31 |
|
|
| 32 |
|
$this->logger->logCall( |
| 33 |
|
__METHOD__, |
| 34 |
|
['location' => $locationId, 'translations' => $translations, 'always-available' => $useAlwaysAvailable] |
| 35 |
|
); |
| 36 |
|
$location = $this->persistenceHandler->locationHandler()->load($locationId, $translations, $useAlwaysAvailable); |
| 37 |
|
|
| 38 |
|
$cacheItem->set($location); |
| 39 |
|
$cacheItem->tag($this->getCacheTags($location)); |
| 40 |
|
$this->cache->save($cacheItem); |
| 41 |
|
|
| 42 |
|
return $location; |
| 43 |
|
} |
| 44 |
|
|
| 45 |
|
/** |
| 46 |
|
* {@inheritdoc} |
|
@@ 127-146 (lines=20) @@
|
| 124 |
|
/** |
| 125 |
|
* {@inheritdoc} |
| 126 |
|
*/ |
| 127 |
|
public function loadByRemoteId($remoteId, array $translations = null, bool $useAlwaysAvailable = true) |
| 128 |
|
{ |
| 129 |
|
$translationsKey = $this->getCacheTranslationKey($translations, $useAlwaysAvailable); |
| 130 |
|
$cacheItem = $this->cache->getItem("ez-location-remoteid-${remoteId}-${translationsKey}"); |
| 131 |
|
if ($cacheItem->isHit()) { |
| 132 |
|
return $cacheItem->get(); |
| 133 |
|
} |
| 134 |
|
|
| 135 |
|
$this->logger->logCall( |
| 136 |
|
__METHOD__, |
| 137 |
|
['location' => $remoteId, 'translations' => $translations, 'always-available' => $useAlwaysAvailable] |
| 138 |
|
); |
| 139 |
|
$location = $this->persistenceHandler->locationHandler()->loadByRemoteId($remoteId, $translations, $useAlwaysAvailable); |
| 140 |
|
|
| 141 |
|
$cacheItem->set($location); |
| 142 |
|
$cacheItem->tag($this->getCacheTags($location)); |
| 143 |
|
$this->cache->save($cacheItem); |
| 144 |
|
|
| 145 |
|
return $location; |
| 146 |
|
} |
| 147 |
|
|
| 148 |
|
/** |
| 149 |
|
* {@inheritdoc} |