Bases: BaseCommand
Mixin for Redis HyperLogLog cardinality estimation commands (e.g. PFADD, PFCOUNT).
Source code in pyredis/commands/hyperloglog.py
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 | class HyperLogLog(BaseCommand):
"""Mixin for Redis HyperLogLog cardinality estimation commands (e.g. PFADD, PFCOUNT)."""
def __init__(self):
super().__init__()
def pfadd(self, *args):
if self._cluster:
return self.execute(
*[b"PFADD", *args],
shard_key=args[0]
)
return self.execute(
*[b"PFADD", *args]
)
def pfcount(self, *args):
if self._cluster:
return self.execute(
*[b"PFCOUNT", *args],
shard_key=args[0]
)
return self.execute(
*[b"PFCOUNT", *args]
)
def pfmerge(self, *args):
if self._cluster:
return self.execute(
*[b"PFMERGE", *args],
shard_key=args[0]
)
return self.execute(
*[b"PFMERGE", *args]
)
|
__init__()
Source code in pyredis/commands/hyperloglog.py
| def __init__(self):
super().__init__()
|
execute(*args, **kwargs)
Source code in pyredis/commands/base.py
| def execute(self, *args, **kwargs):
raise NotImplementedError
|
pfadd(*args)
Source code in pyredis/commands/hyperloglog.py
10
11
12
13
14
15
16
17
18 | def pfadd(self, *args):
if self._cluster:
return self.execute(
*[b"PFADD", *args],
shard_key=args[0]
)
return self.execute(
*[b"PFADD", *args]
)
|
pfcount(*args)
Source code in pyredis/commands/hyperloglog.py
20
21
22
23
24
25
26
27
28 | def pfcount(self, *args):
if self._cluster:
return self.execute(
*[b"PFCOUNT", *args],
shard_key=args[0]
)
return self.execute(
*[b"PFCOUNT", *args]
)
|
pfmerge(*args)
Source code in pyredis/commands/hyperloglog.py
30
31
32
33
34
35
36
37
38 | def pfmerge(self, *args):
if self._cluster:
return self.execute(
*[b"PFMERGE", *args],
shard_key=args[0]
)
return self.execute(
*[b"PFMERGE", *args]
)
|