diff --git a/app/src/Service/Redis.php b/app/src/Service/Redis.php index 5a9845a..1d7f050 100644 --- a/app/src/Service/Redis.php +++ b/app/src/Service/Redis.php @@ -2,6 +2,7 @@ namespace Incoviba\Service; use Predis\Client; +use Incoviba\Common\Implement\Exception\EmptyRedis; class Redis { @@ -9,10 +10,13 @@ class Redis public function get(string $name): mixed { + if (!$this->client->exists($name)) { + throw new EmptyRedis($name); + } return $this->client->get($name); } public function set(string $name, mixed $value): void { - $this->client->set($name, $value); + $this->client->set($name, $value, 'EX', 60 * 60 * 24); } }