Redis expiration 1 day
This commit is contained in:
@ -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);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user