| @@ 20-27 (lines=8) @@ | ||
| 17 | /** |
|
| 18 | * @param int[] $values |
|
| 19 | */ |
|
| 20 | public function increase(array $values) |
|
| 21 | { |
|
| 22 | $pipeline = $this->getRedis()->pipeline(['fire-and-forget' => true]); |
|
| 23 | foreach ($values as $key => $value) { |
|
| 24 | $pipeline->zincrby(self::KEY, $value, $key); |
|
| 25 | } |
|
| 26 | $pipeline->execute(); |
|
| 27 | } |
|
| 28 | ||
| 29 | /** |
|
| 30 | * @param string $key |
|
| @@ 33-43 (lines=11) @@ | ||
| 30 | * @param string $key |
|
| 31 | * @param int $value |
|
| 32 | */ |
|
| 33 | public function set($key, $value) |
|
| 34 | { |
|
| 35 | $pipeline = $this->getRedis()->pipeline(['fire-and-forget' => true]); |
|
| 36 | if ($value) { |
|
| 37 | $pipeline->hset(self::KEY, $key, $value); |
|
| 38 | } else { |
|
| 39 | $pipeline->zrem(self::KEY, $key); |
|
| 40 | } |
|
| 41 | ||
| 42 | $pipeline->execute(); |
|
| 43 | } |
|
| 44 | ||
| 45 | /** |
|
| 46 | * @return int[] |
|