summary refs log tree commit diff stats
path: root/lib/pure
diff options
context:
space:
mode:
authorkrolik <krolik@kologlobal.com>2015-03-06 11:48:37 +0200
committerkrolik <krolik@kologlobal.com>2015-03-06 14:27:16 +0200
commit093b2adf6526b0fd9cb5bd45f394f51d9a21b526 (patch)
tree0d247133aabc1dc514f17a4363de9312fcd6303d /lib/pure
parentfcb44ae4f0ba0efcecd09422de4597f779d43466 (diff)
downloadNim-093b2adf6526b0fd9cb5bd45f394f51d9a21b526.tar.gz
Added HyperLogLog support to Redis client
Diffstat (limited to 'lib/pure')
-rw-r--r--lib/pure/redis.nim16
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/pure/redis.nim b/lib/pure/redis.nim
index 52d81b3a4..64d3e1470 100644
--- a/lib/pure/redis.nim
+++ b/lib/pure/redis.nim
@@ -798,6 +798,22 @@ proc zunionstore*(r: Redis, destination: string, numkeys: string,
   
   return r.readInteger()
 
+# HyperLogLog
+
+proc pfadd*(r: Redis, key: string, elements: varargs[string]): RedisInteger = 
+  ## Add variable number of elements into special 'HyperLogLog' set type
+  r.sendCommand("PFADD", key, elements)
+  return r.readInteger()
+
+proc pfcount*(r: Redis, key: string): RedisInteger =
+  ## Count approximate number of elements in 'HyperLogLog'
+  r.sendCommand("PFCOUNT", key)
+  return r.readInteger()
+
+proc pfmerge*(r: Redis, destination: string, sources: varargs[string]) =
+  ## Merge several source HyperLogLog's into one specified by destKey
+  r.sendCommand("PFMERGE", destination, sources)
+  raiseNoOK(r.readStatus(), r.pipeline.enabled)
 
 # Pub/Sub
 
>161 162 163 164 165 166 167 168 169 170 171 172 173