redis_cluster 0.2.3 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f73539f72f1afc171f22acfd295dbf491f745ec2
4
- data.tar.gz: 25c3ede9fa06f5402d21d3aa5b3aff8df64f77a7
3
+ metadata.gz: 23e7a2c7e3aa40a46f4161e2bb626c241ec3105a
4
+ data.tar.gz: 73dd569bb920fd6c7df63ec9493ed4828e847330
5
5
  SHA512:
6
- metadata.gz: 10437f66a1ca4fe5190d388fddc2e1619ca0fdb1db0c12506ce7cdeb43cd7fe37dba92b70b0a5e98ae323bb96143ec10162c9ef4d13bddd094af56387f250df5
7
- data.tar.gz: 66e1268bfbd524926b61474c13d98bfb249eb7a2bfd71b4c1e6bac0c1ce59bd8b84721ce5a3e520f55779cbcd216e200f37b0418d4eecd9458cccd048dcd690a
6
+ metadata.gz: 06c46ad0e16120b44d787d271b2a808a6eff48a32fbd393ebc74140d4db1284ce1378053c373728ba40638aac9108f42af4a90fd56805180ced6a020fd40946b
7
+ data.tar.gz: 32f938112dc9104674624de00a783a518d827f86e8780b60c6355123925c359f610fa64f0fc0fcf87843485586a0f88da1c5deabcb38cea9aa25aaa3fe6907f8
data/README.md CHANGED
@@ -32,6 +32,11 @@ rs.set "test", 1
32
32
  rs.get "test"
33
33
  ```
34
34
 
35
+ now support keys command with scanning all nodes:
36
+ ```ruby
37
+ rs.keys 'test*'
38
+ ```
39
+
35
40
  ## Benchmark test
36
41
 
37
42
  A simple benchmark at my macbook, start 4 master nodes (and 4 cold slave nodes), running with one ruby process.
@@ -11,7 +11,7 @@ module RedisCluster
11
11
  reload_pool_nodes
12
12
  end
13
13
 
14
- def execute(method, args)
14
+ def execute(method, args, &block)
15
15
  ttl = Configuration::REQUEST_TTL
16
16
  asking = false
17
17
  try_random_node = false
@@ -19,7 +19,7 @@ module RedisCluster
19
19
  while ttl > 0
20
20
  ttl -= 1
21
21
  begin
22
- return @pool.execute(method, args, {asking: asking, random_node: try_random_node})
22
+ return @pool.execute(method, args, {asking: asking, random_node: try_random_node}, &block)
23
23
  rescue Errno::ECONNREFUSED, Redis::TimeoutError, Redis::CannotConnectError, Errno::EACCES
24
24
  try_random_node = true
25
25
  sleep 0.1 if ttl < Configuration::REQUEST_TTL/2
@@ -38,13 +38,13 @@ module RedisCluster
38
38
  end
39
39
 
40
40
  Configuration::SUPPORT_SINGLE_NODE_METHODS.each do |method_name|
41
- define_method method_name do |*args|
42
- execute(method_name, args)
41
+ define_method method_name do |*args, &block|
42
+ execute(method_name, args, &block)
43
43
  end
44
44
  end
45
45
 
46
46
  def method_missing(method, *args, &block)
47
- execute(method, args)
47
+ execute(method, args, &block)
48
48
  end
49
49
 
50
50
  private
@@ -30,8 +30,8 @@ module RedisCluster
30
30
  execute(:asking)
31
31
  end
32
32
 
33
- def execute(method, args)
34
- connection.public_send(method, *args)
33
+ def execute(method, args, &block)
34
+ connection.public_send(method, *args, &block)
35
35
  end
36
36
 
37
37
  def connection
@@ -23,15 +23,15 @@ module RedisCluster
23
23
  # other_options:
24
24
  # asking
25
25
  # random_node
26
- def execute(method, args, other_options)
27
- return keys(args.first) if Configuration::SUPPORT_MULTI_NODE_METHODS.include?(method.to_s)
26
+ def execute(method, args, other_options, &block)
27
+ return send(method, args.first) if Configuration::SUPPORT_MULTI_NODE_METHODS.include?(method.to_s)
28
28
 
29
29
  key = key_by_command(method, args)
30
30
  raise NotSupportError if key.nil?
31
31
 
32
32
  node = other_options[:random_node] ? random_node : node_by(key)
33
33
  node.asking if other_options[:asking]
34
- node.execute(method, args)
34
+ node.execute(method, args, &block)
35
35
  end
36
36
 
37
37
  def keys(glob = "*")
@@ -1,3 +1,3 @@
1
1
  module RedisCluster
2
- VERSION = "0.2.3"
2
+ VERSION = "0.2.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redis_cluster
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - wangzc
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-05-16 00:00:00.000000000 Z
11
+ date: 2016-12-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: redis