Skip to content

Commit

Permalink
[Abstract] Improve detection of wrong value for cache miss (#9)
Browse files Browse the repository at this point in the history
(cherry picked from commit 9e6b5aa)
  • Loading branch information
andrerom committed May 13, 2019
1 parent e0bdb3c commit cd11a7a
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,13 @@ static function ($key, $value, $isHit) use ($defaultLifetime) {
$item->key = $key;
$item->defaultLifetime = $defaultLifetime;
//<diff:AbstractAdapter> extract Value and Tags from the cache value
// Mark as miss if value is not in TagAware format
$item->isHit = \array_key_exists('value', $value ?? []) ? $isHit : false;
$item->value = $value['value'] ?? null;
// If structure does not match what we expect return item as is (no value and not a hit)
if (!\is_array($value) || !\array_key_exists('value', $value)) {
return $item;
}
$item->isHit = $isHit;
// Extract value and tags from the cache value
$item->value = $value['value'];
$item->prevTags = $value['tags'] ?? [];
//</diff:AbstractAdapter>

Expand Down

0 comments on commit cd11a7a

Please sign in to comment.