| @@ 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} |
|
| @@ 182-197 (lines=16) @@ | ||
| 179 | /** |
|
| 180 | * {@inheritdoc} |
|
| 181 | */ |
|
| 182 | public function loadByIdentifier($identifier, $groupId) |
|
| 183 | { |
|
| 184 | $cacheItem = $this->cache->getItem('ez-state-identifier-' . $identifier . '-by-group-' . $groupId); |
|
| 185 | if ($cacheItem->isHit()) { |
|
| 186 | return $cacheItem->get(); |
|
| 187 | } |
|
| 188 | ||
| 189 | $this->logger->logCall(__METHOD__, array('identifier' => $identifier, 'groupId' => $groupId)); |
|
| 190 | $objectState = $this->persistenceHandler->objectStateHandler()->loadByIdentifier($identifier, $groupId); |
|
| 191 | ||
| 192 | $cacheItem->set($objectState); |
|
| 193 | $cacheItem->tag(['state-' . $objectState->id, 'state-group-' . $objectState->groupId]); |
|
| 194 | $this->cache->save($cacheItem); |
|
| 195 | ||
| 196 | return $objectState; |
|
| 197 | } |
|
| 198 | ||
| 199 | /** |
|
| 200 | * {@inheritdoc} |
|
| @@ 254-269 (lines=16) @@ | ||
| 251 | /** |
|
| 252 | * {@inheritdoc} |
|
| 253 | */ |
|
| 254 | public function getContentState($contentId, $stateGroupId) |
|
| 255 | { |
|
| 256 | $cacheItem = $this->cache->getItem('ez-state-by-group-' . $stateGroupId . '-on-content-' . $contentId); |
|
| 257 | if ($cacheItem->isHit()) { |
|
| 258 | return $cacheItem->get(); |
|
| 259 | } |
|
| 260 | ||
| 261 | $this->logger->logCall(__METHOD__, array('contentId' => $contentId, 'stateGroupId' => $stateGroupId)); |
|
| 262 | $contentState = $this->persistenceHandler->objectStateHandler()->getContentState($contentId, $stateGroupId); |
|
| 263 | ||
| 264 | $cacheItem->set($contentState); |
|
| 265 | $cacheItem->tag(['state-' . $contentState->id, 'content-' . $contentId]); |
|
| 266 | $this->cache->save($cacheItem); |
|
| 267 | ||
| 268 | return $contentState; |
|
| 269 | } |
|
| 270 | ||
| 271 | /** |
|
| 272 | * {@inheritdoc} |
|
| @@ 175-190 (lines=16) @@ | ||
| 172 | /** |
|
| 173 | * {@inheritdoc} |
|
| 174 | */ |
|
| 175 | public function load($typeId, $status = Type::STATUS_DEFINED) |
|
| 176 | { |
|
| 177 | $cacheItem = $this->cache->getItem('ez-content-type-' . $typeId . '-' . $status); |
|
| 178 | if ($cacheItem->isHit()) { |
|
| 179 | return $cacheItem->get(); |
|
| 180 | } |
|
| 181 | ||
| 182 | $this->logger->logCall(__METHOD__, array('type' => $typeId, 'status' => $status)); |
|
| 183 | $type = $this->persistenceHandler->contentTypeHandler()->load($typeId, $status); |
|
| 184 | ||
| 185 | $cacheItem->set($type); |
|
| 186 | $cacheItem->tag(['type-' . $type->id]); |
|
| 187 | $this->cache->save($cacheItem); |
|
| 188 | ||
| 189 | return $type; |
|
| 190 | } |
|
| 191 | ||
| 192 | /** |
|
| 193 | * {@inheritdoc} |
|