18
18
CF_INSERT = "CF.INSERT"
19
19
CF_INSERTNX = "CF.INSERTNX"
20
20
CF_EXISTS = "CF.EXISTS"
21
+ CF_MEXISTS = "CF.MEXISTS"
21
22
CF_DEL = "CF.DEL"
22
23
CF_COUNT = "CF.COUNT"
23
24
CF_SCANDUMP = "CF.SCANDUMP"
@@ -59,7 +60,7 @@ def create(self, key, errorRate, capacity, expansion=None, noScale=None):
59
60
Create a new Bloom Filter `key` with desired probability of false positives
60
61
`errorRate` expected entries to be inserted as `capacity`.
61
62
Default expansion value is 2. By default, filter is auto-scaling.
62
- For more information see `BF.RESERVE <https://oss. redis.com/redisbloom/master/Bloom_Commands/#bfreserve >`_.
63
+ For more information see `BF.RESERVE <https://redis.io/commands/bf.reserve >`_.
63
64
""" # noqa
64
65
params = [key , errorRate , capacity ]
65
66
self .append_expansion (params , expansion )
@@ -69,19 +70,16 @@ def create(self, key, errorRate, capacity, expansion=None, noScale=None):
69
70
def add (self , key , item ):
70
71
"""
71
72
Add to a Bloom Filter `key` an `item`.
72
- For more information see `BF.ADD <https://oss. redis.com/redisbloom/master/Bloom_Commands/#bfadd >`_.
73
+ For more information see `BF.ADD <https://redis.io/commands/bf.add >`_.
73
74
""" # noqa
74
- params = [key , item ]
75
- return self .execute_command (BF_ADD , * params )
75
+ return self .execute_command (BF_ADD , key , item )
76
76
77
77
def madd (self , key , * items ):
78
78
"""
79
79
Add to a Bloom Filter `key` multiple `items`.
80
- For more information see `BF.MADD <https://oss. redis.com/redisbloom/master/Bloom_Commands/#bfmadd >`_.
80
+ For more information see `BF.MADD <https://redis.io/commands/bf.madd >`_.
81
81
""" # noqa
82
- params = [key ]
83
- params += items
84
- return self .execute_command (BF_MADD , * params )
82
+ return self .execute_command (BF_MADD , key , * items )
85
83
86
84
def insert (
87
85
self ,
@@ -99,7 +97,7 @@ def insert(
99
97
If `nocreate` remain `None` and `key` does not exist, a new Bloom Filter
100
98
`key` will be created with desired probability of false positives `errorRate`
101
99
and expected entries to be inserted as `size`.
102
- For more information see `BF.INSERT <https://oss. redis.com/redisbloom/master/Bloom_Commands/#bfinsert >`_.
100
+ For more information see `BF.INSERT <https://redis.io/commands/bf.insert >`_.
103
101
""" # noqa
104
102
params = [key ]
105
103
self .append_capacity (params , capacity )
@@ -114,19 +112,16 @@ def insert(
114
112
def exists (self , key , item ):
115
113
"""
116
114
Check whether an `item` exists in Bloom Filter `key`.
117
- For more information see `BF.EXISTS <https://oss. redis.com/redisbloom/master/Bloom_Commands/#bfexists >`_.
115
+ For more information see `BF.EXISTS <https://redis.io/commands/bf.exists >`_.
118
116
""" # noqa
119
- params = [key , item ]
120
- return self .execute_command (BF_EXISTS , * params )
117
+ return self .execute_command (BF_EXISTS , key , item )
121
118
122
119
def mexists (self , key , * items ):
123
120
"""
124
121
Check whether `items` exist in Bloom Filter `key`.
125
- For more information see `BF.MEXISTS <https://oss. redis.com/redisbloom/master/Bloom_Commands/#bfmexists >`_.
122
+ For more information see `BF.MEXISTS <https://redis.io/commands/bf.mexists >`_.
126
123
""" # noqa
127
- params = [key ]
128
- params += items
129
- return self .execute_command (BF_MEXISTS , * params )
124
+ return self .execute_command (BF_MEXISTS , key , * items )
130
125
131
126
def scandump (self , key , iter ):
132
127
"""
@@ -135,7 +130,7 @@ def scandump(self, key, iter):
135
130
This is useful for large bloom filters which cannot fit into the normal SAVE and RESTORE model.
136
131
The first time this command is called, the value of `iter` should be 0.
137
132
This command will return successive (iter, data) pairs until (0, NULL) to indicate completion.
138
- For more information see `BF.SCANDUMP <https://oss. redis.com/redisbloom/master/Bloom_Commands/#bfscandump >`_.
133
+ For more information see `BF.SCANDUMP <https://redis.io/commands/bf.scandump >`_.
139
134
""" # noqa
140
135
if HIREDIS_AVAILABLE :
141
136
raise ModuleError ("This command cannot be used when hiredis is available." )
@@ -152,15 +147,14 @@ def loadchunk(self, key, iter, data):
152
147
See the SCANDUMP command for example usage.
153
148
This command will overwrite any bloom filter stored under key.
154
149
Ensure that the bloom filter will not be modified between invocations.
155
- For more information see `BF.LOADCHUNK <https://oss. redis.com/redisbloom/master/Bloom_Commands/#bfloadchunk >`_.
150
+ For more information see `BF.LOADCHUNK <https://redis.io/commands/bf.loadchunk >`_.
156
151
""" # noqa
157
- params = [key , iter , data ]
158
- return self .execute_command (BF_LOADCHUNK , * params )
152
+ return self .execute_command (BF_LOADCHUNK , key , iter , data )
159
153
160
154
def info (self , key ):
161
155
"""
162
156
Return capacity, size, number of filters, number of items inserted, and expansion rate.
163
- For more information see `BF.INFO <https://oss. redis.com/redisbloom/master/Bloom_Commands/#bfinfo >`_.
157
+ For more information see `BF.INFO <https://redis.io/commands/bf.info >`_.
164
158
""" # noqa
165
159
return self .execute_command (BF_INFO , key )
166
160
@@ -187,17 +181,15 @@ def add(self, key, item):
187
181
Add an `item` to a Cuckoo Filter `key`.
188
182
For more information see `CF.ADD <https://redis.io/commands/cf.add>`_.
189
183
""" # noqa
190
- params = [key , item ]
191
- return self .execute_command (CF_ADD , * params )
184
+ return self .execute_command (CF_ADD , key , item )
192
185
193
186
def addnx (self , key , item ):
194
187
"""
195
188
Add an `item` to a Cuckoo Filter `key` only if item does not yet exist.
196
189
Command might be slower that `add`.
197
190
For more information see `CF.ADDNX <https://redis.io/commands/cf.addnx>`_.
198
191
""" # noqa
199
- params = [key , item ]
200
- return self .execute_command (CF_ADDNX , * params )
192
+ return self .execute_command (CF_ADDNX , key , item )
201
193
202
194
def insert (self , key , items , capacity = None , nocreate = None ):
203
195
"""
@@ -230,24 +222,28 @@ def exists(self, key, item):
230
222
Check whether an `item` exists in Cuckoo Filter `key`.
231
223
For more information see `CF.EXISTS <https://redis.io/commands/cf.exists>`_.
232
224
""" # noqa
233
- params = [key , item ]
234
- return self .execute_command (CF_EXISTS , * params )
225
+ return self .execute_command (CF_EXISTS , key , item )
226
+
227
+ def mexists (self , key , * items ):
228
+ """
229
+ Check whether an `items` exist in Cuckoo Filter `key`.
230
+ For more information see `CF.MEXISTS <https://redis.io/commands/cf.mexists>`_.
231
+ """ # noqa
232
+ return self .execute_command (CF_MEXISTS , key , * items )
235
233
236
234
def delete (self , key , item ):
237
235
"""
238
236
Delete `item` from `key`.
239
237
For more information see `CF.DEL <https://redis.io/commands/cf.del>`_.
240
238
""" # noqa
241
- params = [key , item ]
242
- return self .execute_command (CF_DEL , * params )
239
+ return self .execute_command (CF_DEL , key , item )
243
240
244
241
def count (self , key , item ):
245
242
"""
246
243
Return the number of times an `item` may be in the `key`.
247
244
For more information see `CF.COUNT <https://redis.io/commands/cf.count>`_.
248
245
""" # noqa
249
- params = [key , item ]
250
- return self .execute_command (CF_COUNT , * params )
246
+ return self .execute_command (CF_COUNT , key , item )
251
247
252
248
def scandump (self , key , iter ):
253
249
"""
@@ -260,8 +256,7 @@ def scandump(self, key, iter):
260
256
(0, NULL) to indicate completion.
261
257
For more information see `CF.SCANDUMP <https://redis.io/commands/cf.scandump>`_.
262
258
""" # noqa
263
- params = [key , iter ]
264
- return self .execute_command (CF_SCANDUMP , * params )
259
+ return self .execute_command (CF_SCANDUMP , key , iter )
265
260
266
261
def loadchunk (self , key , iter , data ):
267
262
"""
@@ -271,8 +266,7 @@ def loadchunk(self, key, iter, data):
271
266
Ensure that the Cuckoo filter will not be modified between invocations.
272
267
For more information see `CF.LOADCHUNK <https://redis.io/commands/cf.loadchunk>`_.
273
268
""" # noqa
274
- params = [key , iter , data ]
275
- return self .execute_command (CF_LOADCHUNK , * params )
269
+ return self .execute_command (CF_LOADCHUNK , key , iter , data )
276
270
277
271
def info (self , key ):
278
272
"""
@@ -292,17 +286,14 @@ def reserve(self, key, k, width, depth, decay):
292
286
positives `errorRate` expected entries to be inserted as `size`.
293
287
For more information see `TOPK.RESERVE <https://redis.io/commands/topk.reserve>`_.
294
288
""" # noqa
295
- params = [key , k , width , depth , decay ]
296
- return self .execute_command (TOPK_RESERVE , * params )
289
+ return self .execute_command (TOPK_RESERVE , key , k , width , depth , decay )
297
290
298
291
def add (self , key , * items ):
299
292
"""
300
293
Add one `item` or more to a Top-K Filter `key`.
301
294
For more information see `TOPK.ADD <https://redis.io/commands/topk.add>`_.
302
295
""" # noqa
303
- params = [key ]
304
- params += items
305
- return self .execute_command (TOPK_ADD , * params )
296
+ return self .execute_command (TOPK_ADD , key , * items )
306
297
307
298
def incrby (self , key , items , increments ):
308
299
"""
@@ -323,18 +314,14 @@ def query(self, key, *items):
323
314
Check whether one `item` or more is a Top-K item at `key`.
324
315
For more information see `TOPK.QUERY <https://redis.io/commands/topk.query>`_.
325
316
""" # noqa
326
- params = [key ]
327
- params += items
328
- return self .execute_command (TOPK_QUERY , * params )
317
+ return self .execute_command (TOPK_QUERY , key , * items )
329
318
330
319
def count (self , key , * items ):
331
320
"""
332
321
Return count for one `item` or more from `key`.
333
322
For more information see `TOPK.COUNT <https://redis.io/commands/topk.count>`_.
334
323
""" # noqa
335
- params = [key ]
336
- params += items
337
- return self .execute_command (TOPK_COUNT , * params )
324
+ return self .execute_command (TOPK_COUNT , key , * items )
338
325
339
326
def list (self , key , withcount = False ):
340
327
"""
@@ -362,8 +349,7 @@ def create(self, key, compression):
362
349
Allocate the memory and initialize the t-digest.
363
350
For more information see `TDIGEST.CREATE <https://redis.io/commands/tdigest.create>`_.
364
351
""" # noqa
365
- params = [key , compression ]
366
- return self .execute_command (TDIGEST_CREATE , * params )
352
+ return self .execute_command (TDIGEST_CREATE , key , compression )
367
353
368
354
def reset (self , key ):
369
355
"""
@@ -391,8 +377,7 @@ def merge(self, toKey, fromKey):
391
377
Merge all of the values from 'fromKey' to 'toKey' sketch.
392
378
For more information see `TDIGEST.MERGE <https://redis.io/commands/tdigest.merge>`_.
393
379
""" # noqa
394
- params = [toKey , fromKey ]
395
- return self .execute_command (TDIGEST_MERGE , * params )
380
+ return self .execute_command (TDIGEST_MERGE , toKey , fromKey )
396
381
397
382
def min (self , key ):
398
383
"""
@@ -414,16 +399,14 @@ def quantile(self, key, quantile):
414
399
added to this TDigest would be less than or equal to the cutoff.
415
400
For more information see `TDIGEST.QUANTILE <https://redis.io/commands/tdigest.quantile>`_.
416
401
""" # noqa
417
- params = [key , quantile ]
418
- return self .execute_command (TDIGEST_QUANTILE , * params )
402
+ return self .execute_command (TDIGEST_QUANTILE , key , quantile )
419
403
420
404
def cdf (self , key , value ):
421
405
"""
422
406
Return double fraction of all points added which are <= value.
423
407
For more information see `TDIGEST.CDF <https://redis.io/commands/tdigest.cdf>`_.
424
408
""" # noqa
425
- params = [key , value ]
426
- return self .execute_command (TDIGEST_CDF , * params )
409
+ return self .execute_command (TDIGEST_CDF , key , value )
427
410
428
411
def info (self , key ):
429
412
"""
@@ -443,16 +426,14 @@ def initbydim(self, key, width, depth):
443
426
Initialize a Count-Min Sketch `key` to dimensions (`width`, `depth`) specified by user.
444
427
For more information see `CMS.INITBYDIM <https://redis.io/commands/cms.initbydim>`_.
445
428
""" # noqa
446
- params = [key , width , depth ]
447
- return self .execute_command (CMS_INITBYDIM , * params )
429
+ return self .execute_command (CMS_INITBYDIM , key , width , depth )
448
430
449
431
def initbyprob (self , key , error , probability ):
450
432
"""
451
433
Initialize a Count-Min Sketch `key` to characteristics (`error`, `probability`) specified by user.
452
434
For more information see `CMS.INITBYPROB <https://redis.io/commands/cms.initbyprob>`_.
453
435
""" # noqa
454
- params = [key , error , probability ]
455
- return self .execute_command (CMS_INITBYPROB , * params )
436
+ return self .execute_command (CMS_INITBYPROB , key , error , probability )
456
437
457
438
def incrby (self , key , items , increments ):
458
439
"""
@@ -473,9 +454,7 @@ def query(self, key, *items):
473
454
Return count for an `item` from `key`. Multiple items can be queried with one call.
474
455
For more information see `CMS.QUERY <https://redis.io/commands/cms.query>`_.
475
456
""" # noqa
476
- params = [key ]
477
- params += items
478
- return self .execute_command (CMS_QUERY , * params )
457
+ return self .execute_command (CMS_QUERY , key , * items )
479
458
480
459
def merge (self , destKey , numKeys , srcKeys , weights = []):
481
460
"""
0 commit comments