Skip to content

Commit

Permalink
Merge pull request #64 from Swanty/prevent-null-decoding
Browse files Browse the repository at this point in the history
Prevent decoding if redis returns null (key does not exist)
  • Loading branch information
spiritix authored May 14, 2018
2 parents e8e8720 + c623297 commit fe1057c
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Spiritix/LadaCache/Cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,11 @@ public function get($key)
{
$encoded = $this->redis->get($this->redis->prefix($key));

// Prevent decoding if redis returns null (key does not exist).
if ($encoded === null) {
return null;
}

return $this->encoder->decode($encoded);
}

Expand Down

0 comments on commit fe1057c

Please sign in to comment.