oxblood 0.1.0.dev11 → 0.1.0.dev12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8748b287262e6e3f061b9c4359472527f8c32937
4
- data.tar.gz: a42f3aeea15b7220730a5fdd37bda6f73955b231
3
+ metadata.gz: 30b1991382a2df8f7fdfb18563b7da0d10b105e8
4
+ data.tar.gz: af6cfe127dd7f4d0469b6a98464b30096b9ef726
5
5
  SHA512:
6
- metadata.gz: b39975b37b8b7c4ec046b42a4edef9a24e080c63fee98f3ac1455123409c60f4dccd4234200d05a7297847c7dd2d2c85b20266023e7b6502ef45eec69eeca648
7
- data.tar.gz: 17fa53c914114183a3460edf8b64e127b5d379aab83ebc8bf97a9cbd35eb5062d9acc18010a6efba44e21e9331a216381357be57dc0f631a9cf473c9c403c6c2
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 (0/3)
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)
@@ -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
@@ -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)
@@ -1,3 +1,3 @@
1
1
  module Oxblood
2
- VERSION = '0.1.0.dev11'
2
+ VERSION = '0.1.0.dev12'
3
3
  end
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.dev11
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