-
-
Notifications
You must be signed in to change notification settings - Fork 40
/
Copy pathPubSubCommandsTrait.php
43 lines (38 loc) · 1.34 KB
/
PubSubCommandsTrait.php
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
43
<?php
/**
* This file is part of RedisClient.
* git: https://github.com/cheprasov/php-redis-client
*
* (C) Alexander Cheprasov <acheprasov84@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace RedisClient\Command\Traits\Version2x8;
use RedisClient\Command\Traits\Version2x6\PubSubCommandsTrait as PubSubCommandsTraitVersion2x6;
/**
* PubSub Commands
* @link http://redis.io/commands#pubsub
*/
trait PubSubCommandsTrait {
use PubSubCommandsTraitVersion2x6;
/**
* PUBSUB subcommand [argument [argument ...]]
* Available since 2.8.0.
* Time complexity: O(N) for the CHANNELS subcommand, where N is the number of active channels,
* and assuming constant time pattern matching (relatively short channels and patterns).
* O(N) for the NUMSUB subcommand, where N is the number of requested channels.
* O(1) for the NUMPAT subcommand.
*
* @param string $subcommand CHANNELS|NUMSUB|NUMPAT
* @param string|string[] $arguments
* @return array|int
*/
public function pubsub($subcommand, $arguments = null) {
$params = [$subcommand];
if (isset($arguments)) {
$params[] = (array) $arguments;
}
return $this->returnCommand(['PUBSUB'], null, $params);
}
}