@@ -12,17 +12,30 @@ class Predis implements RedisClient
1212 RedisClient::OPT_PREFIX => 'prefix ' ,
1313 ];
1414
15+ /**
16+ * @var Client
17+ */
1518 private $ client ;
1619
20+ /**
21+ * @var mixed[]
22+ */
1723 private $ options = [];
1824
25+ /**
26+ * @param mixed[] $options
27+ */
1928 public function __construct (Client $ redis , array $ options )
2029 {
2130 $ this ->client = $ redis ;
2231
2332 $ this ->options = $ options ;
2433 }
2534
35+ /**
36+ * @param mixed[] $parameters
37+ * @param mixed[] $options
38+ */
2639 public static function create (array $ parameters , array $ options ): self
2740 {
2841 $ redisClient = new Client ($ parameters , $ options );
@@ -46,11 +59,17 @@ public function eval(string $script, array $args = [], int $num_keys = 0): void
4659 $ this ->client ->eval ($ script , $ num_keys , ...$ args );
4760 }
4861
49- public function set (string $ key , mixed $ value , mixed $ options = null ): void
62+ public function set (string $ key , mixed $ value , mixed $ options = null ): bool
5063 {
51- $ this ->client ->set ($ key , $ value , ...$ this ->flattenFlags ($ options ));
64+ $ result = $ this ->client ->set ($ key , $ value , ...$ this ->flattenFlags ($ options ));
65+
66+ return (string ) $ result === 'OK ' ;
5267 }
5368
69+ /**
70+ * @param array<int|string, mixed> $flags
71+ * @return mixed[]
72+ */
5473 private function flattenFlags (array $ flags ): array
5574 {
5675 $ result = [];
@@ -73,10 +92,10 @@ public function setNx(string $key, mixed $value): void
7392
7493 public function hSetNx (string $ key , string $ field , mixed $ value ): bool
7594 {
76- return $ this ->hsetnx ($ key , $ field , $ value );
95+ return $ this ->hSetNx ($ key , $ field , $ value );
7796 }
7897
79- public function sMembers (string $ key ): array | false
98+ public function sMembers (string $ key ): array
8099 {
81100 return $ this ->client ->smembers ($ key );
82101 }
0 commit comments