-
Notifications
You must be signed in to change notification settings - Fork 56
Expand file tree
/
Copy pathRedisQueue.php
More file actions
42 lines (34 loc) · 796 Bytes
/
RedisQueue.php
File metadata and controls
42 lines (34 loc) · 796 Bytes
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
<?php
declare(strict_types=1);
/**
* SPDX-FileCopyrightText: 2020 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCA\NotifyPush\Queue;
class RedisQueue implements IQueue {
private $redis;
/**
* @param \Redis|\RedisCluster $redis
*/
public function __construct($redis) {
$this->redis = $redis;
}
#[\Override]
public function push(string $channel, $message): void {
$this->redis->publish($channel, json_encode($message));
}
/**
* @return \Redis|\RedisCluster
*/
public function getConnection() {
return $this->redis;
}
#[\Override]
public function set(string $key, $value): void {
$this->redis->set($key, $value);
}
#[\Override]
public function get(string $key) {
return $this->redis->get($key);
}
}