| @@ 53-68 (lines=16) @@ | ||
| 50 | /** |
|
| 51 | * {@inheritdoc} |
|
| 52 | */ |
|
| 53 | public function load($id) |
|
| 54 | { |
|
| 55 | $cacheItem = $this->cache->getItem('ez-language-'.$id); |
|
| 56 | if ($cacheItem->isHit()) { |
|
| 57 | return $cacheItem->get(); |
|
| 58 | } |
|
| 59 | ||
| 60 | $this->logger->logCall(__METHOD__, array('language' => $id)); |
|
| 61 | $language = $this->persistenceHandler->contentLanguageHandler()->load($id); |
|
| 62 | ||
| 63 | $cacheItem->set($language); |
|
| 64 | $cacheItem->tag('language-'.$language->id); |
|
| 65 | $this->cache->save($cacheItem); |
|
| 66 | ||
| 67 | return $language; |
|
| 68 | } |
|
| 69 | ||
| 70 | /** |
|
| 71 | * {@inheritdoc} |
|
| @@ 73-88 (lines=16) @@ | ||
| 70 | /** |
|
| 71 | * {@inheritdoc} |
|
| 72 | */ |
|
| 73 | public function loadByLanguageCode($languageCode) |
|
| 74 | { |
|
| 75 | $cacheItem = $this->cache->getItem('ez-language-'.$languageCode.'-by-code'); |
|
| 76 | if ($cacheItem->isHit()) { |
|
| 77 | return $cacheItem->get(); |
|
| 78 | } |
|
| 79 | ||
| 80 | $this->logger->logCall(__METHOD__, array('language' => $languageCode)); |
|
| 81 | $language = $this->persistenceHandler->contentLanguageHandler()->loadByLanguageCode($languageCode); |
|
| 82 | ||
| 83 | $cacheItem->set($language); |
|
| 84 | $cacheItem->tag('language-'.$language->id); |
|
| 85 | $this->cache->save($cacheItem); |
|
| 86 | ||
| 87 | return $language; |
|
| 88 | } |
|
| 89 | ||
| 90 | /** |
|
| 91 | * {@inheritdoc} |
|
| @@ 74-89 (lines=16) @@ | ||
| 71 | /** |
|
| 72 | * {@inheritdoc} |
|
| 73 | */ |
|
| 74 | public function loadGroup($groupId) |
|
| 75 | { |
|
| 76 | $cacheItem = $this->cache->getItem('ez-content-type-group-'.$groupId); |
|
| 77 | if ($cacheItem->isHit()) { |
|
| 78 | return $cacheItem->get(); |
|
| 79 | } |
|
| 80 | ||
| 81 | $this->logger->logCall(__METHOD__, array('group' => $groupId)); |
|
| 82 | $group = $this->persistenceHandler->contentTypeHandler()->loadGroup($groupId); |
|
| 83 | ||
| 84 | $cacheItem->set($group); |
|
| 85 | $cacheItem->tag('type-group-'.$group->id); |
|
| 86 | $this->cache->save($cacheItem); |
|
| 87 | ||
| 88 | return $group; |
|
| 89 | } |
|
| 90 | ||
| 91 | /** |
|
| 92 | * {@inheritdoc} |
|
| @@ 94-109 (lines=16) @@ | ||
| 91 | /** |
|
| 92 | * {@inheritdoc} |
|
| 93 | */ |
|
| 94 | public function loadGroupByIdentifier($identifier) |
|
| 95 | { |
|
| 96 | $cacheItem = $this->cache->getItem('ez-content-type-group-'.$identifier.'-by-identifier'); |
|
| 97 | if ($cacheItem->isHit()) { |
|
| 98 | return $cacheItem->get(); |
|
| 99 | } |
|
| 100 | ||
| 101 | $this->logger->logCall(__METHOD__, array('group' => $identifier)); |
|
| 102 | $group = $this->persistenceHandler->contentTypeHandler()->loadGroupByIdentifier($identifier); |
|
| 103 | ||
| 104 | $cacheItem->set($group); |
|
| 105 | $cacheItem->tag('type-group-'.$group->id); |
|
| 106 | $this->cache->save($cacheItem); |
|
| 107 | ||
| 108 | return $group; |
|
| 109 | } |
|
| 110 | ||
| 111 | /** |
|
| 112 | * {@inheritdoc} |
|
| @@ 182-197 (lines=16) @@ | ||
| 179 | /** |
|
| 180 | * {@inheritdoc} |
|
| 181 | */ |
|
| 182 | public function loadByIdentifier($identifier) |
|
| 183 | { |
|
| 184 | $cacheItem = $this->cache->getItem('ez-content-type-'.$identifier.'-by-identifier'); |
|
| 185 | if ($cacheItem->isHit()) { |
|
| 186 | return $cacheItem->get(); |
|
| 187 | } |
|
| 188 | ||
| 189 | $this->logger->logCall(__METHOD__, array('type' => $identifier)); |
|
| 190 | $type = $this->persistenceHandler->contentTypeHandler()->loadByIdentifier($identifier); |
|
| 191 | ||
| 192 | $cacheItem->set($type); |
|
| 193 | $cacheItem->tag(['type-'.$type->id]); |
|
| 194 | $this->cache->save($cacheItem); |
|
| 195 | ||
| 196 | return $type; |
|
| 197 | } |
|
| 198 | ||
| 199 | /** |
|
| 200 | * {@inheritdoc} |
|
| @@ 202-217 (lines=16) @@ | ||
| 199 | /** |
|
| 200 | * {@inheritdoc} |
|
| 201 | */ |
|
| 202 | public function loadByRemoteId($remoteId) |
|
| 203 | { |
|
| 204 | $cacheItem = $this->cache->getItem('ez-content-type-'.$remoteId.'-by-remote'); |
|
| 205 | if ($cacheItem->isHit()) { |
|
| 206 | return $cacheItem->get(); |
|
| 207 | } |
|
| 208 | ||
| 209 | $this->logger->logCall(__METHOD__, array('type' => $remoteId)); |
|
| 210 | $type = $this->persistenceHandler->contentTypeHandler()->loadByRemoteId($remoteId); |
|
| 211 | ||
| 212 | $cacheItem->set($type); |
|
| 213 | $cacheItem->tag(['type-'.$type->id]); |
|
| 214 | $this->cache->save($cacheItem); |
|
| 215 | ||
| 216 | return $type; |
|
| 217 | } |
|
| 218 | ||
| 219 | /** |
|
| 220 | * {@inheritdoc} |
|
| @@ 40-55 (lines=16) @@ | ||
| 37 | /** |
|
| 38 | * @see \eZ\Publish\SPI\Persistence\Content\ObjectState\Handler::loadGroup |
|
| 39 | */ |
|
| 40 | public function loadGroup($groupId) |
|
| 41 | { |
|
| 42 | $cacheItem = $this->cache->getItem('ez-state-group-'.$groupId); |
|
| 43 | if ($cacheItem->isHit()) { |
|
| 44 | return $cacheItem->get(); |
|
| 45 | } |
|
| 46 | ||
| 47 | $this->logger->logCall(__METHOD__, array('groupId' => $groupId)); |
|
| 48 | $group = $this->persistenceHandler->objectStateHandler()->loadGroup($groupId); |
|
| 49 | ||
| 50 | $cacheItem->set($group); |
|
| 51 | $cacheItem->tag(['state-group-'.$group->id]); |
|
| 52 | $this->cache->save($cacheItem); |
|
| 53 | ||
| 54 | return $group; |
|
| 55 | } |
|
| 56 | ||
| 57 | /** |
|
| 58 | * @see \eZ\Publish\SPI\Persistence\Content\ObjectState\Handler::loadGroupByIdentifier |
|
| @@ 60-75 (lines=16) @@ | ||
| 57 | /** |
|
| 58 | * @see \eZ\Publish\SPI\Persistence\Content\ObjectState\Handler::loadGroupByIdentifier |
|
| 59 | */ |
|
| 60 | public function loadGroupByIdentifier($identifier) |
|
| 61 | { |
|
| 62 | $cacheItem = $this->cache->getItem('ez-state-group-identifier-'.$identifier); |
|
| 63 | if ($cacheItem->isHit()) { |
|
| 64 | return $cacheItem->get(); |
|
| 65 | } |
|
| 66 | ||
| 67 | $this->logger->logCall(__METHOD__, array('groupId' => $identifier)); |
|
| 68 | $group = $this->persistenceHandler->objectStateHandler()->loadGroupByIdentifier($identifier); |
|
| 69 | ||
| 70 | $cacheItem->set($group); |
|
| 71 | $cacheItem->tag(['state-group-'.$group->id]); |
|
| 72 | $this->cache->save($cacheItem); |
|
| 73 | ||
| 74 | return $group; |
|
| 75 | } |
|
| 76 | ||
| 77 | /** |
|
| 78 | * @see \eZ\Publish\SPI\Persistence\Content\ObjectState\Handler::loadAllGroups |
|
| @@ 167-182 (lines=16) @@ | ||
| 164 | /** |
|
| 165 | * @see \eZ\Publish\SPI\Persistence\Content\ObjectState\Handler::load |
|
| 166 | */ |
|
| 167 | public function load($stateId) |
|
| 168 | { |
|
| 169 | $cacheItem = $this->cache->getItem('ez-state-'.$stateId); |
|
| 170 | if ($cacheItem->isHit()) { |
|
| 171 | return $cacheItem->get(); |
|
| 172 | } |
|
| 173 | ||
| 174 | $this->logger->logCall(__METHOD__, array('stateId' => $stateId)); |
|
| 175 | $objectState = $this->persistenceHandler->objectStateHandler()->load($stateId); |
|
| 176 | ||
| 177 | $cacheItem->set($objectState); |
|
| 178 | $cacheItem->tag(['state-'.$objectState->id,'state-group-'.$objectState->groupId]); |
|
| 179 | $this->cache->save($cacheItem); |
|
| 180 | ||
| 181 | return $objectState; |
|
| 182 | } |
|
| 183 | ||
| 184 | /** |
|
| 185 | * @see \eZ\Publish\SPI\Persistence\Content\ObjectState\Handler::loadByIdentifier |
|
| @@ 54-69 (lines=16) @@ | ||
| 51 | /** |
|
| 52 | * @see eZ\Publish\SPI\Persistence\Content\Section\Handler |
|
| 53 | */ |
|
| 54 | public function load($id) |
|
| 55 | { |
|
| 56 | $cacheItem = $this->cache->getItem('ez-section-'.$id); |
|
| 57 | if ($cacheItem->isHit()) { |
|
| 58 | return $cacheItem->get(); |
|
| 59 | } |
|
| 60 | ||
| 61 | $this->logger->logCall(__METHOD__, array('section' => $id)); |
|
| 62 | $section = $this->persistenceHandler->sectionHandler()->load($id); |
|
| 63 | ||
| 64 | $cacheItem->set($section); |
|
| 65 | $cacheItem->tag(['section-'.$section->id]); |
|
| 66 | $this->cache->save($cacheItem); |
|
| 67 | ||
| 68 | return $section; |
|
| 69 | } |
|
| 70 | ||
| 71 | /** |
|
| 72 | * Get all section data. |
|
| @@ 92-107 (lines=16) @@ | ||
| 89 | * |
|
| 90 | * @return \eZ\Publish\SPI\Persistence\Content\Section |
|
| 91 | */ |
|
| 92 | public function loadByIdentifier($identifier) |
|
| 93 | { |
|
| 94 | $cacheItem = $this->cache->getItem('ez-section-identifier-'.$identifier); |
|
| 95 | if ($cacheItem->isHit()) { |
|
| 96 | return $cacheItem->get(); |
|
| 97 | } |
|
| 98 | ||
| 99 | $this->logger->logCall(__METHOD__, array('section' => $identifier)); |
|
| 100 | $section = $this->persistenceHandler->sectionHandler()->loadByIdentifier($identifier); |
|
| 101 | ||
| 102 | $cacheItem->set($section); |
|
| 103 | $cacheItem->tag(['section-'.$section->id]); |
|
| 104 | $this->cache->save($cacheItem); |
|
| 105 | ||
| 106 | return $section; |
|
| 107 | } |
|
| 108 | ||
| 109 | /** |
|
| 110 | * @see eZ\Publish\SPI\Persistence\Content\Section\Handler |
|
| @@ 230-248 (lines=19) @@ | ||
| 227 | /** |
|
| 228 | * @see eZ\Publish\SPI\Persistence\Content\UrlAlias\Handler::loadUrlAlias |
|
| 229 | */ |
|
| 230 | public function loadUrlAlias($id) |
|
| 231 | { |
|
| 232 | $cacheItem = $this->cache->getItem('ez-urlAlias-', $id); |
|
| 233 | if ($cacheItem->isHit()) { |
|
| 234 | return $cacheItem->get(); |
|
| 235 | } |
|
| 236 | ||
| 237 | $this->logger->logCall(__METHOD__, array('alias' => $id)); |
|
| 238 | $urlAlias = $this->persistenceHandler->urlAliasHandler()->loadUrlAlias($id); |
|
| 239 | ||
| 240 | $cacheItem->set($urlAlias); |
|
| 241 | if ($urlAlias->type === UrlAlias::LOCATION) { |
|
| 242 | $cacheItem->tag(['urlAlias-location-'.$urlAlias->destination]); |
|
| 243 | } |
|
| 244 | $this->cache->save($cacheItem); |
|
| 245 | ||
| 246 | ||
| 247 | return $urlAlias; |
|
| 248 | } |
|
| 249 | ||
| 250 | /** |
|
| 251 | * @see eZ\Publish\SPI\Persistence\Content\UrlAlias\Handler::locationMoved |
|
| @@ 41-56 (lines=16) @@ | ||
| 38 | /** |
|
| 39 | * @see eZ\Publish\SPI\Persistence\User\Handler::load |
|
| 40 | */ |
|
| 41 | public function load($userId) |
|
| 42 | { |
|
| 43 | $cacheItem = $this->cache->getItem("ez-user-${userId}"); |
|
| 44 | if ($cacheItem->isHit()) { |
|
| 45 | return $cacheItem->get(); |
|
| 46 | } |
|
| 47 | ||
| 48 | $this->logger->logCall(__METHOD__, array('user' => $userId)); |
|
| 49 | $user = $this->persistenceHandler->userHandler()->load($userId); |
|
| 50 | ||
| 51 | $cacheItem->set($user); |
|
| 52 | $cacheItem->tag(['content-'.$user->id, 'user-'.$user->id]); |
|
| 53 | $this->cache->save($cacheItem); |
|
| 54 | ||
| 55 | return $user; |
|
| 56 | } |
|
| 57 | ||
| 58 | /** |
|
| 59 | * @see eZ\Publish\SPI\Persistence\User\Handler::loadByLogin |
|
| @@ 61-76 (lines=16) @@ | ||
| 58 | /** |
|
| 59 | * @see eZ\Publish\SPI\Persistence\User\Handler::loadByLogin |
|
| 60 | */ |
|
| 61 | public function loadByLogin($login) |
|
| 62 | { |
|
| 63 | $cacheItem = $this->cache->getItem("ez-user-login-${login}"); |
|
| 64 | if ($cacheItem->isHit()) { |
|
| 65 | return $cacheItem->get(); |
|
| 66 | } |
|
| 67 | ||
| 68 | $this->logger->logCall(__METHOD__, array('user' => $login)); |
|
| 69 | $user = $this->persistenceHandler->userHandler()->loadByLogin($login); |
|
| 70 | ||
| 71 | $cacheItem->set($user); |
|
| 72 | $cacheItem->tag(['content-'.$user->id, 'user-'.$user->id]); |
|
| 73 | $this->cache->save($cacheItem); |
|
| 74 | ||
| 75 | return $user; |
|
| 76 | } |
|
| 77 | ||
| 78 | /** |
|
| 79 | * @see eZ\Publish\SPI\Persistence\User\Handler::loadByEmail |
|