-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRedisCacheRepository.php
44 lines (34 loc) · 1.02 KB
/
RedisCacheRepository.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php
namespace LaSalle\Rendimiento\JudithVilela\ImageRegister\Infrastructure\Persistence\Repository;
use LaSalle\Rendimiento\JudithVilela\ImageRegister\Infrastructure\Persistence\RedisCache;
final class RedisCacheRepository
{
/** @var RedisCache */
private $redisClient;
public function __construct()
{
$this->redisClient = RedisCache::instanceREDIS();
}
public function save(): void
{
}
public function saveAll(string $key, array $arrayElements): void
{
$this->redisClient->set($key, json_encode($arrayElements));
}
public function find(string $key): ?string
{
if (!($this->redisClient->get($key))) {
return null;
}
return $this->redisClient->get($key);
}
public function findAll(string $key): array
{
return json_decode($this->redisClient->get($key), true);
}
public function delete(string $key): void
{
$this->redisClient->del($key);
}
}