| @@ 46-61 (lines=16) @@ | ||
| 43 | /** |
|
| 44 | * {@inheritdoc} |
|
| 45 | */ |
|
| 46 | public function load($id) |
|
| 47 | { |
|
| 48 | $cacheItem = $this->cache->getItem('ez-language-' . $id); |
|
| 49 | if ($cacheItem->isHit()) { |
|
| 50 | return $cacheItem->get(); |
|
| 51 | } |
|
| 52 | ||
| 53 | $this->logger->logCall(__METHOD__, array('language' => $id)); |
|
| 54 | $language = $this->persistenceHandler->contentLanguageHandler()->load($id); |
|
| 55 | ||
| 56 | $cacheItem->set($language); |
|
| 57 | $cacheItem->tag('language-' . $language->id); |
|
| 58 | $this->cache->save($cacheItem); |
|
| 59 | ||
| 60 | return $language; |
|
| 61 | } |
|
| 62 | ||
| 63 | /** |
|
| 64 | * {@inheritdoc} |
|
| @@ 67-82 (lines=16) @@ | ||
| 64 | /** |
|
| 65 | * {@inheritdoc} |
|
| 66 | */ |
|
| 67 | public function loadGroup($groupId) |
|
| 68 | { |
|
| 69 | $cacheItem = $this->cache->getItem('ez-content-type-group-' . $groupId); |
|
| 70 | if ($cacheItem->isHit()) { |
|
| 71 | return $cacheItem->get(); |
|
| 72 | } |
|
| 73 | ||
| 74 | $this->logger->logCall(__METHOD__, array('group' => $groupId)); |
|
| 75 | $group = $this->persistenceHandler->contentTypeHandler()->loadGroup($groupId); |
|
| 76 | ||
| 77 | $cacheItem->set($group); |
|
| 78 | $cacheItem->tag('type-group-' . $group->id); |
|
| 79 | $this->cache->save($cacheItem); |
|
| 80 | ||
| 81 | return $group; |
|
| 82 | } |
|
| 83 | ||
| 84 | /** |
|
| 85 | * {@inheritdoc} |
|
| @@ 187-202 (lines=16) @@ | ||
| 184 | /** |
|
| 185 | * {@inheritdoc} |
|
| 186 | */ |
|
| 187 | public function loadByIdentifier($identifier) |
|
| 188 | { |
|
| 189 | $cacheItem = $this->cache->getItem('ez-content-type-' . $identifier . '-by-identifier'); |
|
| 190 | if ($cacheItem->isHit()) { |
|
| 191 | return $cacheItem->get(); |
|
| 192 | } |
|
| 193 | ||
| 194 | $this->logger->logCall(__METHOD__, array('type' => $identifier)); |
|
| 195 | $type = $this->persistenceHandler->contentTypeHandler()->loadByIdentifier($identifier); |
|
| 196 | ||
| 197 | $cacheItem->set($type); |
|
| 198 | $cacheItem->tag(['type-' . $type->id]); |
|
| 199 | $this->cache->save($cacheItem); |
|
| 200 | ||
| 201 | return $type; |
|
| 202 | } |
|
| 203 | ||
| 204 | /** |
|
| 205 | * {@inheritdoc} |
|
| @@ 207-222 (lines=16) @@ | ||
| 204 | /** |
|
| 205 | * {@inheritdoc} |
|
| 206 | */ |
|
| 207 | public function loadByRemoteId($remoteId) |
|
| 208 | { |
|
| 209 | $cacheItem = $this->cache->getItem('ez-content-type-' . $remoteId . '-by-remote'); |
|
| 210 | if ($cacheItem->isHit()) { |
|
| 211 | return $cacheItem->get(); |
|
| 212 | } |
|
| 213 | ||
| 214 | $this->logger->logCall(__METHOD__, array('type' => $remoteId)); |
|
| 215 | $type = $this->persistenceHandler->contentTypeHandler()->loadByRemoteId($remoteId); |
|
| 216 | ||
| 217 | $cacheItem->set($type); |
|
| 218 | $cacheItem->tag(['type-' . $type->id]); |
|
| 219 | $this->cache->save($cacheItem); |
|
| 220 | ||
| 221 | return $type; |
|
| 222 | } |
|
| 223 | ||
| 224 | /** |
|
| 225 | * {@inheritdoc} |
|
| @@ 35-50 (lines=16) @@ | ||
| 32 | /** |
|
| 33 | * {@inheritdoc} |
|
| 34 | */ |
|
| 35 | public function loadGroup($groupId) |
|
| 36 | { |
|
| 37 | $cacheItem = $this->cache->getItem('ez-state-group-' . $groupId); |
|
| 38 | if ($cacheItem->isHit()) { |
|
| 39 | return $cacheItem->get(); |
|
| 40 | } |
|
| 41 | ||
| 42 | $this->logger->logCall(__METHOD__, array('groupId' => $groupId)); |
|
| 43 | $group = $this->persistenceHandler->objectStateHandler()->loadGroup($groupId); |
|
| 44 | ||
| 45 | $cacheItem->set($group); |
|
| 46 | $cacheItem->tag(['state-group-' . $group->id]); |
|
| 47 | $this->cache->save($cacheItem); |
|
| 48 | ||
| 49 | return $group; |
|
| 50 | } |
|
| 51 | ||
| 52 | /** |
|
| 53 | * {@inheritdoc} |
|
| @@ 55-70 (lines=16) @@ | ||
| 52 | /** |
|
| 53 | * {@inheritdoc} |
|
| 54 | */ |
|
| 55 | public function loadGroupByIdentifier($identifier) |
|
| 56 | { |
|
| 57 | $cacheItem = $this->cache->getItem('ez-state-group-' . $identifier . '-by-identifier'); |
|
| 58 | if ($cacheItem->isHit()) { |
|
| 59 | return $cacheItem->get(); |
|
| 60 | } |
|
| 61 | ||
| 62 | $this->logger->logCall(__METHOD__, array('groupId' => $identifier)); |
|
| 63 | $group = $this->persistenceHandler->objectStateHandler()->loadGroupByIdentifier($identifier); |
|
| 64 | ||
| 65 | $cacheItem->set($group); |
|
| 66 | $cacheItem->tag(['state-group-' . $group->id]); |
|
| 67 | $this->cache->save($cacheItem); |
|
| 68 | ||
| 69 | return $group; |
|
| 70 | } |
|
| 71 | ||
| 72 | /** |
|
| 73 | * {@inheritdoc} |
|
| @@ 162-177 (lines=16) @@ | ||
| 159 | /** |
|
| 160 | * {@inheritdoc} |
|
| 161 | */ |
|
| 162 | public function load($stateId) |
|
| 163 | { |
|
| 164 | $cacheItem = $this->cache->getItem('ez-state-' . $stateId); |
|
| 165 | if ($cacheItem->isHit()) { |
|
| 166 | return $cacheItem->get(); |
|
| 167 | } |
|
| 168 | ||
| 169 | $this->logger->logCall(__METHOD__, array('stateId' => $stateId)); |
|
| 170 | $objectState = $this->persistenceHandler->objectStateHandler()->load($stateId); |
|
| 171 | ||
| 172 | $cacheItem->set($objectState); |
|
| 173 | $cacheItem->tag(['state-' . $objectState->id, 'state-group-' . $objectState->groupId]); |
|
| 174 | $this->cache->save($cacheItem); |
|
| 175 | ||
| 176 | return $objectState; |
|
| 177 | } |
|
| 178 | ||
| 179 | /** |
|
| 180 | * {@inheritdoc} |
|
| @@ 44-59 (lines=16) @@ | ||
| 41 | /** |
|
| 42 | * {@inheritdoc} |
|
| 43 | */ |
|
| 44 | public function load($id) |
|
| 45 | { |
|
| 46 | $cacheItem = $this->cache->getItem('ez-section-' . $id); |
|
| 47 | if ($cacheItem->isHit()) { |
|
| 48 | return $cacheItem->get(); |
|
| 49 | } |
|
| 50 | ||
| 51 | $this->logger->logCall(__METHOD__, array('section' => $id)); |
|
| 52 | $section = $this->persistenceHandler->sectionHandler()->load($id); |
|
| 53 | ||
| 54 | $cacheItem->set($section); |
|
| 55 | $cacheItem->tag(['section-' . $section->id]); |
|
| 56 | $this->cache->save($cacheItem); |
|
| 57 | ||
| 58 | return $section; |
|
| 59 | } |
|
| 60 | ||
| 61 | /** |
|
| 62 | * {@inheritdoc} |
|
| @@ 74-89 (lines=16) @@ | ||
| 71 | /** |
|
| 72 | * {@inheritdoc} |
|
| 73 | */ |
|
| 74 | public function loadByIdentifier($identifier) |
|
| 75 | { |
|
| 76 | $cacheItem = $this->cache->getItem('ez-section-' . $identifier . '-by-identifier'); |
|
| 77 | if ($cacheItem->isHit()) { |
|
| 78 | return $cacheItem->get(); |
|
| 79 | } |
|
| 80 | ||
| 81 | $this->logger->logCall(__METHOD__, array('section' => $identifier)); |
|
| 82 | $section = $this->persistenceHandler->sectionHandler()->loadByIdentifier($identifier); |
|
| 83 | ||
| 84 | $cacheItem->set($section); |
|
| 85 | $cacheItem->tag(['section-' . $section->id]); |
|
| 86 | $this->cache->save($cacheItem); |
|
| 87 | ||
| 88 | return $section; |
|
| 89 | } |
|
| 90 | ||
| 91 | /** |
|
| 92 | * {@inheritdoc} |
|
| @@ 58-75 (lines=18) @@ | ||
| 55 | /** |
|
| 56 | * {@inheritdoc} |
|
| 57 | */ |
|
| 58 | public function loadById($id) |
|
| 59 | { |
|
| 60 | $cacheItem = $this->cache->getItem('ez-url-' . $id); |
|
| 61 | ||
| 62 | $url = $cacheItem->get(); |
|
| 63 | if ($cacheItem->isHit()) { |
|
| 64 | return $url; |
|
| 65 | } |
|
| 66 | ||
| 67 | $this->logger->logCall(__METHOD__, ['url' => $id]); |
|
| 68 | $url = $this->persistenceHandler->urlHandler()->loadById($id); |
|
| 69 | ||
| 70 | $cacheItem->set($url); |
|
| 71 | $cacheItem->tag(['url-' . $id]); |
|
| 72 | $this->cache->save($cacheItem); |
|
| 73 | ||
| 74 | return $url; |
|
| 75 | } |
|
| 76 | ||
| 77 | /** |
|
| 78 | * {@inheritdoc} |
|
| @@ 42-57 (lines=16) @@ | ||
| 39 | /** |
|
| 40 | * {@inheritdoc} |
|
| 41 | */ |
|
| 42 | public function load($userId) |
|
| 43 | { |
|
| 44 | $cacheItem = $this->cache->getItem("ez-user-${userId}"); |
|
| 45 | if ($cacheItem->isHit()) { |
|
| 46 | return $cacheItem->get(); |
|
| 47 | } |
|
| 48 | ||
| 49 | $this->logger->logCall(__METHOD__, array('user' => $userId)); |
|
| 50 | $user = $this->persistenceHandler->userHandler()->load($userId); |
|
| 51 | ||
| 52 | $cacheItem->set($user); |
|
| 53 | $cacheItem->tag(['content-' . $user->id, 'user-' . $user->id]); |
|
| 54 | $this->cache->save($cacheItem); |
|
| 55 | ||
| 56 | return $user; |
|
| 57 | } |
|
| 58 | ||
| 59 | /** |
|
| 60 | * {@inheritdoc} |
|
| @@ 107-122 (lines=16) @@ | ||
| 104 | /** |
|
| 105 | * {@inheritdoc} |
|
| 106 | */ |
|
| 107 | public function loadUserByToken($hash) |
|
| 108 | { |
|
| 109 | $cacheItem = $this->cache->getItem('ez-user-' . $hash . '-by-account-key'); |
|
| 110 | if ($cacheItem->isHit()) { |
|
| 111 | return $cacheItem->get(); |
|
| 112 | } |
|
| 113 | ||
| 114 | $this->logger->logCall(__METHOD__, array('hash' => $hash)); |
|
| 115 | $user = $this->persistenceHandler->userHandler()->loadUserByToken($hash); |
|
| 116 | ||
| 117 | $cacheItem->set($user); |
|
| 118 | $cacheItem->tag(['content-' . $user->id, 'user-' . $user->id]); |
|
| 119 | $this->cache->save($cacheItem); |
|
| 120 | ||
| 121 | return $user; |
|
| 122 | } |
|
| 123 | ||
| 124 | /** |
|
| 125 | * {@inheritdoc} |
|