redis-cluster-client 0.13.3 → 0.13.5
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
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0abe95ee2079026038121cd93e8ae7929726ee4206b3d1f401dc7ed82f1da2c8
|
4
|
+
data.tar.gz: 7fa2e9c6c20d814f54e2fcf8045094869b4b5fc6c39144a8900328a9f5401abc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 26be35f5eb57e7280b8a38441f3d80c4956638a68418cf6964bdbf27d4cb3051f5955179b90066409c908ce771f3ee4286d0e569711d198ffcbfc22a70cc49bf
|
7
|
+
data.tar.gz: 976db1b41a2d3592dac70bf25ea8f44308824bbc7009082dd54fe68ad01b934e1b572b89df1f3b9e45b791851966c909a022defae45f4d9c3270469e9d6acc88
|
@@ -12,6 +12,7 @@ class RedisClient
|
|
12
12
|
end
|
13
13
|
|
14
14
|
ERR_ARG_NORMALIZATION = ->(arg) { Array[arg].flatten.reject { |e| e.nil? || (e.respond_to?(:empty?) && e.empty?) } }
|
15
|
+
Ractor.make_shareable(ERR_ARG_NORMALIZATION) if Object.const_defined?(:Ractor, false) && Ractor.respond_to?(:make_shareable)
|
15
16
|
|
16
17
|
private_constant :ERR_ARG_NORMALIZATION
|
17
18
|
|
@@ -17,9 +17,19 @@ class RedisClient
|
|
17
17
|
class Router
|
18
18
|
ZERO_CURSOR_FOR_SCAN = '0'
|
19
19
|
TSF = ->(f, x) { f.nil? ? x : f.call(x) }.curry
|
20
|
+
Ractor.make_shareable(TSF) if Object.const_defined?(:Ractor, false) && Ractor.respond_to?(:make_shareable)
|
20
21
|
DEDICATED_ACTIONS = lambda do # rubocop:disable Metrics/BlockLength
|
21
22
|
action = Struct.new('RedisCommandRoutingAction', :method_name, :reply_transformer, keyword_init: true)
|
22
23
|
pick_first = ->(reply) { reply.first } # rubocop:disable Style/SymbolProc
|
24
|
+
flatten_strings = ->(reply) { reply.flatten.sort_by(&:to_s) }
|
25
|
+
sum_num = ->(reply) { reply.select { |e| e.is_a?(Integer) }.sum }
|
26
|
+
sort_numbers = ->(reply) { reply.sort_by(&:to_i) }
|
27
|
+
if Object.const_defined?(:Ractor, false) && Ractor.respond_to?(:make_shareable)
|
28
|
+
Ractor.make_shareable(pick_first)
|
29
|
+
Ractor.make_shareable(flatten_strings)
|
30
|
+
Ractor.make_shareable(sum_num)
|
31
|
+
Ractor.make_shareable(sort_numbers)
|
32
|
+
end
|
23
33
|
multiple_key_action = action.new(method_name: :send_multiple_keys_command)
|
24
34
|
all_node_first_action = action.new(method_name: :send_command_to_all_nodes, reply_transformer: pick_first)
|
25
35
|
primary_first_action = action.new(method_name: :send_command_to_primaries, reply_transformer: pick_first)
|
@@ -28,10 +38,10 @@ class RedisClient
|
|
28
38
|
{
|
29
39
|
'ping' => action.new(method_name: :send_ping_command, reply_transformer: pick_first),
|
30
40
|
'wait' => action.new(method_name: :send_wait_command),
|
31
|
-
'keys' => action.new(method_name: :send_command_to_replicas, reply_transformer:
|
32
|
-
'dbsize' => action.new(method_name: :send_command_to_replicas, reply_transformer:
|
41
|
+
'keys' => action.new(method_name: :send_command_to_replicas, reply_transformer: flatten_strings),
|
42
|
+
'dbsize' => action.new(method_name: :send_command_to_replicas, reply_transformer: sum_num),
|
33
43
|
'scan' => action.new(method_name: :send_scan_command),
|
34
|
-
'lastsave' => action.new(method_name: :send_command_to_all_nodes, reply_transformer:
|
44
|
+
'lastsave' => action.new(method_name: :send_command_to_all_nodes, reply_transformer: sort_numbers),
|
35
45
|
'role' => action.new(method_name: :send_command_to_all_nodes),
|
36
46
|
'config' => action.new(method_name: :send_config_command),
|
37
47
|
'client' => action.new(method_name: :send_client_command),
|
@@ -59,8 +69,8 @@ class RedisClient
|
|
59
69
|
'multi' => keyless_action,
|
60
70
|
'unwatch' => keyless_action
|
61
71
|
}.each_with_object({}) do |(k, v), acc|
|
62
|
-
acc[k] = v
|
63
|
-
acc[k.upcase] = v
|
72
|
+
acc[k] = v.freeze
|
73
|
+
acc[k.upcase] = v.freeze
|
64
74
|
end
|
65
75
|
end.call.freeze
|
66
76
|
|
@@ -14,7 +14,9 @@ class RedisClient
|
|
14
14
|
DEFAULT_PORT = 6379
|
15
15
|
DEFAULT_SCHEME = 'redis'
|
16
16
|
SECURE_SCHEME = 'rediss'
|
17
|
-
|
17
|
+
DEFAULT_NODE = "#{DEFAULT_SCHEME}://#{DEFAULT_HOST}:#{DEFAULT_PORT}"
|
18
|
+
Ractor.make_shareable(DEFAULT_NODE) if Object.const_defined?(:Ractor, false) && Ractor.respond_to?(:make_shareable)
|
19
|
+
DEFAULT_NODES = [DEFAULT_NODE].freeze
|
18
20
|
VALID_SCHEMES = [DEFAULT_SCHEME, SECURE_SCHEME].freeze
|
19
21
|
VALID_NODES_KEYS = %i[ssl username password host port db].freeze
|
20
22
|
MERGE_CONFIG_KEYS = %i[ssl username password].freeze
|
@@ -67,10 +69,18 @@ class RedisClient
|
|
67
69
|
"#<#{self.class.name} #{startup_nodes.values.map { |v| v.reject { |k| k == :command_builder } }}>"
|
68
70
|
end
|
69
71
|
|
72
|
+
def connect_timeout
|
73
|
+
@client_config[:connect_timeout] || @client_config[:timeout] || ::RedisClient::Config::DEFAULT_TIMEOUT
|
74
|
+
end
|
75
|
+
|
70
76
|
def read_timeout
|
71
77
|
@client_config[:read_timeout] || @client_config[:timeout] || ::RedisClient::Config::DEFAULT_TIMEOUT
|
72
78
|
end
|
73
79
|
|
80
|
+
def write_timeout
|
81
|
+
@client_config[:write_timeout] || @client_config[:timeout] || ::RedisClient::Config::DEFAULT_TIMEOUT
|
82
|
+
end
|
83
|
+
|
74
84
|
def new_pool(size: 5, timeout: 5, **kwargs)
|
75
85
|
@client_implementation.new(
|
76
86
|
self,
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: redis-cluster-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.13.
|
4
|
+
version: 0.13.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Taishi Kasuga
|
8
8
|
bindir: bin
|
9
9
|
cert_chain: []
|
10
|
-
date:
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: redis-client
|
@@ -15,14 +15,14 @@ dependencies:
|
|
15
15
|
requirements:
|
16
16
|
- - "~>"
|
17
17
|
- !ruby/object:Gem::Version
|
18
|
-
version: '0.
|
18
|
+
version: '0.24'
|
19
19
|
type: :runtime
|
20
20
|
prerelease: false
|
21
21
|
version_requirements: !ruby/object:Gem::Requirement
|
22
22
|
requirements:
|
23
23
|
- - "~>"
|
24
24
|
- !ruby/object:Gem::Version
|
25
|
-
version: '0.
|
25
|
+
version: '0.24'
|
26
26
|
email:
|
27
27
|
- proxy0721@gmail.com
|
28
28
|
executables: []
|
@@ -74,7 +74,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '0'
|
76
76
|
requirements: []
|
77
|
-
rubygems_version: 3.6.
|
77
|
+
rubygems_version: 3.6.7
|
78
78
|
specification_version: 4
|
79
79
|
summary: Redis cluster-aware client for Ruby
|
80
80
|
test_files: []
|