| @@ 172-187 (lines=16) @@ | ||
| 169 | /** |
|
| 170 | * {@inheritdoc} |
|
| 171 | */ |
|
| 172 | public function get($key, $default = null) |
|
| 173 | { |
|
| 174 | KeyUtil::validate($key); |
|
| 175 | ||
| 176 | try { |
|
| 177 | $serialized = $this->clientGet($key); |
|
| 178 | } catch (Exception $e) { |
|
| 179 | throw ReadException::forException($e); |
|
| 180 | } |
|
| 181 | ||
| 182 | if ($this->clientNotFoundValue() === $serialized) { |
|
| 183 | return $default; |
|
| 184 | } |
|
| 185 | ||
| 186 | return Serializer::unserialize($serialized); |
|
| 187 | } |
|
| 188 | ||
| 189 | /** |
|
| 190 | * {@inheritdoc} |
|
| @@ 192-207 (lines=16) @@ | ||
| 189 | /** |
|
| 190 | * {@inheritdoc} |
|
| 191 | */ |
|
| 192 | public function getOrFail($key) |
|
| 193 | { |
|
| 194 | KeyUtil::validate($key); |
|
| 195 | ||
| 196 | try { |
|
| 197 | $serialized = $this->clientGet($key); |
|
| 198 | } catch (Exception $e) { |
|
| 199 | throw ReadException::forException($e); |
|
| 200 | } |
|
| 201 | ||
| 202 | if ($this->clientNotFoundValue() === $serialized) { |
|
| 203 | throw NoSuchKeyException::forKey($key); |
|
| 204 | } |
|
| 205 | ||
| 206 | return Serializer::unserialize($serialized); |
|
| 207 | } |
|
| 208 | ||
| 209 | /** |
|
| 210 | * {@inheritdoc} |
|