| Total Complexity | 6 |
| Total Lines | 82 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 5 | abstract class Connection |
||
| 6 | { |
||
| 7 | /** |
||
| 8 | * @var \Predis\Client |
||
| 9 | */ |
||
| 10 | protected $client; |
||
| 11 | |||
| 12 | /** |
||
| 13 | * @see https://redis.io/commands/hgetall |
||
| 14 | * |
||
| 15 | * @param string $key |
||
| 16 | * |
||
| 17 | * @return array |
||
| 18 | */ |
||
| 19 | 12 | public function hgetall(string $key): array |
|
| 20 | { |
||
| 21 | 12 | return $this->client->hgetall($key); |
|
| 22 | } |
||
| 23 | |||
| 24 | /** |
||
| 25 | * @see https://redis.io/commands/lrange |
||
| 26 | * |
||
| 27 | * @param string $key |
||
| 28 | * @param int $start |
||
| 29 | * @param int $stop |
||
| 30 | * |
||
| 31 | * @return array |
||
| 32 | */ |
||
| 33 | 2 | public function lrange(string $key, int $start, int $stop): array |
|
| 34 | { |
||
| 35 | 2 | return $this->client->lrange($key, $start, $stop); |
|
| 36 | } |
||
| 37 | |||
| 38 | /** |
||
| 39 | * @see https://redis.io/commands/hincrbyfloat |
||
| 40 | * |
||
| 41 | * @param string $key |
||
| 42 | * @param string $field |
||
| 43 | * @param float $value |
||
| 44 | * |
||
| 45 | * @return float |
||
| 46 | */ |
||
| 47 | 8 | public function hincrbyfloat(string $key, string $field, float $value): float |
|
| 50 | } |
||
| 51 | |||
| 52 | /** |
||
| 53 | * @see https://redis.io/commands/hset |
||
| 54 | * |
||
| 55 | * @param string $key |
||
| 56 | * @param string $field |
||
| 57 | * @param mixed $value |
||
| 58 | * |
||
| 59 | * @return int |
||
| 60 | */ |
||
| 61 | 2 | public function hset(string $key, string $field, mixed $value): int |
|
| 62 | { |
||
| 63 | 2 | return $this->client->hset($key, $field, $value); |
|
| 64 | } |
||
| 65 | |||
| 66 | /** |
||
| 67 | * @see https://redis.io/commands/rpush |
||
| 68 | * |
||
| 69 | * @param string $key |
||
| 70 | * @param array $values |
||
| 71 | * |
||
| 72 | * @return int |
||
| 73 | */ |
||
| 74 | 2 | public function rpush(string $key, array $values): int |
|
| 75 | { |
||
| 76 | 2 | return $this->client->rpush($key, ...$values); |
|
| 77 | } |
||
| 78 | |||
| 79 | /** |
||
| 80 | * @see https://redis.io/commands/flushdb |
||
| 81 | * |
||
| 82 | * @return bool |
||
| 83 | */ |
||
| 84 | 6 | public function flushdb(): bool |
|
| 87 | } |
||
| 88 | } |
||
| 89 |