oxblood 0.1.0.dev11 → 0.1.0.dev12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/oxblood/commands.rb +2 -0
- data/lib/oxblood/commands/hyper_log_log.rb +40 -0
- data/lib/oxblood/session.rb +11 -0
- data/lib/oxblood/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 30b1991382a2df8f7fdfb18563b7da0d10b105e8
|
4
|
+
data.tar.gz: af6cfe127dd7f4d0469b6a98464b30096b9ef726
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7b839abf82ef981cd459a2b2e4dad29e690788fcd33ba5b242670b19bc2ed96cce01580427a1da685a1ae89db9f53f003e9a1371ce8d853bbde5f9652df479c4
|
7
|
+
data.tar.gz: c28a49faf89c1b92090c371b1d943259e80df75571522cfe8998c45f4a7fe0cfab44fa7ec8f5c346fddacc8176c6d17515b3c516ac2a2b7e5cc27e79f39db358
|
data/README.md
CHANGED
@@ -19,7 +19,7 @@ A straightforward Redis Ruby client.
|
|
19
19
|
- [Connection](http://www.rubydoc.info/github/etehtsea/oxblood/master/Oxblood/Commands/Connection)
|
20
20
|
- Geo (0/6)
|
21
21
|
- [Hashes](http://www.rubydoc.info/github/etehtsea/oxblood/master/Oxblood/Commands/Hashes) (14/15) (See [#3])
|
22
|
-
- HyperLogLog
|
22
|
+
- [HyperLogLog](http://www.rubydoc.info/github/etehtsea/oxblood/master/Oxblood/Commands/HyperLogLog)
|
23
23
|
- [Keys](http://www.rubydoc.info/github/etehtsea/oxblood/master/Oxblood/Commands/Keys) (18/22) (See [#4], [#6], [#7], [#8])
|
24
24
|
- [Lists](http://www.rubydoc.info/github/etehtsea/oxblood/master/Oxblood/Commands/Lists)
|
25
25
|
- Pub/Sub (0/6)
|
data/lib/oxblood/commands.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'oxblood/commands/hashes'
|
2
|
+
require 'oxblood/commands/hyper_log_log'
|
2
3
|
require 'oxblood/commands/strings'
|
3
4
|
require 'oxblood/commands/connection'
|
4
5
|
require 'oxblood/commands/server'
|
@@ -11,6 +12,7 @@ require 'oxblood/commands/transactions'
|
|
11
12
|
module Oxblood
|
12
13
|
module Commands
|
13
14
|
include Hashes
|
15
|
+
include HyperLogLog
|
14
16
|
include Strings
|
15
17
|
include Connection
|
16
18
|
include Server
|
@@ -0,0 +1,40 @@
|
|
1
|
+
module Oxblood
|
2
|
+
module Commands
|
3
|
+
module HyperLogLog
|
4
|
+
# Adds the specified elements to the specified HyperLogLog.
|
5
|
+
# @see https://redis.io/commands/pfadd
|
6
|
+
#
|
7
|
+
# @param [String] key
|
8
|
+
# @param [String, Array<String>] elements
|
9
|
+
#
|
10
|
+
# @return [Integer] 1 if at least 1 HyperLogLog internal register was
|
11
|
+
# altered and 0 otherwise.
|
12
|
+
def pfadd(key, *elements)
|
13
|
+
run(*elements.unshift(:PFADD, key))
|
14
|
+
end
|
15
|
+
|
16
|
+
# Return the approximated cardinality of the set(s) observed by
|
17
|
+
# the HyperLogLog at key(s).
|
18
|
+
# @see https://redis.io/commands/pfcount
|
19
|
+
#
|
20
|
+
# @param [String, Array<String>] keys
|
21
|
+
#
|
22
|
+
# @return [Integer] the approximated number of unique elements observed
|
23
|
+
# via {pfadd}.
|
24
|
+
def pfcount(*keys)
|
25
|
+
run(*keys.unshift(:PFCOUNT))
|
26
|
+
end
|
27
|
+
|
28
|
+
# Merge N different HyperLogLogs into a single one.
|
29
|
+
# @see https://redis.io/commands/pfmerge
|
30
|
+
#
|
31
|
+
# @param [String] destkey
|
32
|
+
# @param [String, Array<String>] sourcekeys
|
33
|
+
#
|
34
|
+
# @return [String] 'OK'
|
35
|
+
def pfmerge(destkey, *sourcekeys)
|
36
|
+
run(*sourcekeys.unshift(:PFMERGE, destkey))
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
data/lib/oxblood/session.rb
CHANGED
@@ -41,6 +41,17 @@ module Oxblood
|
|
41
41
|
pipeline.sync
|
42
42
|
end
|
43
43
|
|
44
|
+
# Send command to Redis server and read response from it.
|
45
|
+
# Useful for executing unimplemented in adapter Redis commands.
|
46
|
+
#
|
47
|
+
# @example
|
48
|
+
# session.run_command(:CLIENT, :SETNAME, 'cust-name') => 'OK'
|
49
|
+
#
|
50
|
+
# @param [Array] command Array of command name with it's args
|
51
|
+
def run_command(*command)
|
52
|
+
connection.run_command(*command)
|
53
|
+
end
|
54
|
+
|
44
55
|
private
|
45
56
|
|
46
57
|
def run(*command)
|
data/lib/oxblood/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: oxblood
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.0.
|
4
|
+
version: 0.1.0.dev12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Konstantin Shabanov
|
@@ -118,6 +118,7 @@ files:
|
|
118
118
|
- lib/oxblood/commands.rb
|
119
119
|
- lib/oxblood/commands/connection.rb
|
120
120
|
- lib/oxblood/commands/hashes.rb
|
121
|
+
- lib/oxblood/commands/hyper_log_log.rb
|
121
122
|
- lib/oxblood/commands/keys.rb
|
122
123
|
- lib/oxblood/commands/lists.rb
|
123
124
|
- lib/oxblood/commands/server.rb
|