@@ -31,10 +31,10 @@ discard block |
||
31 | 31 | |
32 | 32 | public function increment(string $key, int $value, ?string $member = null): bool |
33 | 33 | { |
34 | - if (! empty($member) || is_numeric($member)) { |
|
35 | - $this->connection->zincrby($this->prefix.$key, $value, $member); |
|
34 | + if (!empty($member) || is_numeric($member)) { |
|
35 | + $this->connection->zincrby($this->prefix . $key, $value, $member); |
|
36 | 36 | } else { |
37 | - $this->connection->incrby($this->prefix.$key, $value); |
|
37 | + $this->connection->incrby($this->prefix . $key, $value); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | // both methods returns integer and raise an excpetion in case of an error. |
@@ -48,35 +48,35 @@ discard block |
||
48 | 48 | |
49 | 49 | public function delete($key, ?string $member = null): bool |
50 | 50 | { |
51 | - if(is_array($key)) { |
|
51 | + if (is_array($key)) { |
|
52 | 52 | array_walk($key, function($item) { |
53 | 53 | $this->delete($item); |
54 | 54 | }); |
55 | 55 | return true; |
56 | 56 | } |
57 | 57 | |
58 | - if(! empty($member) || is_numeric($member)) { |
|
59 | - return $this->connection->zrem($this->prefix.$key, $member) > 0; |
|
58 | + if (!empty($member) || is_numeric($member)) { |
|
59 | + return $this->connection->zrem($this->prefix . $key, $member) > 0; |
|
60 | 60 | } else { |
61 | - return $this->connection->del($this->prefix.$key) > 0; |
|
61 | + return $this->connection->del($this->prefix . $key) > 0; |
|
62 | 62 | } |
63 | 63 | } |
64 | 64 | |
65 | 65 | public function get(string $key, ?string $member = null) |
66 | 66 | { |
67 | - if(! empty($member) || is_numeric($member)) { |
|
68 | - return $this->connection->zscore($this->prefix.$key, $member); |
|
67 | + if (!empty($member) || is_numeric($member)) { |
|
68 | + return $this->connection->zscore($this->prefix . $key, $member); |
|
69 | 69 | } else { |
70 | - return $this->connection->get($this->prefix.$key); |
|
70 | + return $this->connection->get($this->prefix . $key); |
|
71 | 71 | } |
72 | 72 | } |
73 | 73 | |
74 | 74 | public function set(string $key, $value, ?string $member = null): bool |
75 | 75 | { |
76 | - if(! empty($member) || is_numeric($member)) { |
|
77 | - return $this->connection->zAdd($this->prefix.$key, $value, $member) > 0; |
|
76 | + if (!empty($member) || is_numeric($member)) { |
|
77 | + return $this->connection->zAdd($this->prefix . $key, $value, $member) > 0; |
|
78 | 78 | } else { |
79 | - return (bool) $this->connection->set($this->prefix.$key, $value); |
|
79 | + return (bool) $this->connection->set($this->prefix . $key, $value); |
|
80 | 80 | } |
81 | 81 | } |
82 | 82 | |
@@ -90,39 +90,39 @@ discard block |
||
90 | 90 | |
91 | 91 | return $item; |
92 | 92 | }, |
93 | - $this->connection->keys($this->prefix.$word) ?? [] |
|
93 | + $this->connection->keys($this->prefix . $word) ?? [] |
|
94 | 94 | ); |
95 | 95 | } |
96 | 96 | |
97 | 97 | public function flatList(string $key, int $limit = -1): array |
98 | 98 | { |
99 | - return $this->connection->lrange($this->prefix.$key, 0, $limit); |
|
99 | + return $this->connection->lrange($this->prefix . $key, 0, $limit); |
|
100 | 100 | } |
101 | 101 | |
102 | 102 | public function addToFlatList(string $key, $value): bool |
103 | 103 | { |
104 | - return $this->connection->rpush($this->prefix.$key, $value) !== false; |
|
104 | + return $this->connection->rpush($this->prefix . $key, $value) !== false; |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | public function valueList(string $key, int $limit = -1, bool $orderByAsc = false, bool $withValues = false): array |
108 | 108 | { |
109 | 109 | $range = $orderByAsc ? 'zrange' : 'zrevrange'; |
110 | 110 | |
111 | - return $this->connection->$range($this->prefix.$key, 0, $limit, $this->isPHPRedis ? $withValues : ['withscores' => $withValues]); |
|
111 | + return $this->connection->$range($this->prefix . $key, 0, $limit, $this->isPHPRedis ? $withValues : ['withscores' => $withValues]); |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | public function exists(string $key): bool |
115 | 115 | { |
116 | - return (bool) $this->connection->exists($this->prefix.$key); |
|
116 | + return (bool) $this->connection->exists($this->prefix . $key); |
|
117 | 117 | } |
118 | 118 | |
119 | 119 | public function timeLeft(string $key): int |
120 | 120 | { |
121 | - return $this->connection->ttl($this->prefix.$key); |
|
121 | + return $this->connection->ttl($this->prefix . $key); |
|
122 | 122 | } |
123 | 123 | |
124 | 124 | public function setExpiration(string $key, int $time): bool |
125 | 125 | { |
126 | - return $this->connection->expire($this->prefix.$key, $time); |
|
126 | + return $this->connection->expire($this->prefix . $key, $time); |
|
127 | 127 | } |
128 | 128 | } |
129 | 129 | \ No newline at end of file |