redis-cluster-client 0.7.9 → 0.7.11
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 +4 -4
- data/lib/redis_client/cluster/optimistic_locking.rb +3 -2
- data/lib/redis_client/cluster/router.rb +16 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 84e0a41582397ffdb79a5bad130f849ef3980dd00e602908c76006224e0663ed
|
4
|
+
data.tar.gz: e987165bfcbbdda0ef5c122a88d36c21ebf7ade0ea6f8009203b7bb8a87a2736
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2bd0e3de07bad00ea4ade79f397c75ee4e9b244655bd3f5bb6ecfec9a25ca0c3893fb9fa135eb16d01b0c1b7747375c4e5d37c3683befe47fcc34bbd0c34d619
|
7
|
+
data.tar.gz: 5f84cd60815f57769ba3750f6f4e644ed4cdd933b5318ea4aa5ae725711c8ed87ea14e2ef252c92c66589645131e7a0a6381b2b8411fa56475768d2326cc69e6
|
@@ -8,6 +8,8 @@ require 'redis_client/cluster/key_slot_converter'
|
|
8
8
|
require 'redis_client/cluster/node'
|
9
9
|
require 'redis_client/cluster/node_key'
|
10
10
|
require 'redis_client/cluster/normalized_cmd_name'
|
11
|
+
require 'redis_client/cluster/transaction'
|
12
|
+
require 'redis_client/cluster/optimistic_locking'
|
11
13
|
|
12
14
|
class RedisClient
|
13
15
|
class Cluster
|
@@ -44,6 +46,7 @@ class RedisClient
|
|
44
46
|
when 'memory' then send_memory_command(method, command, args, &block)
|
45
47
|
when 'script' then send_script_command(method, command, args, &block)
|
46
48
|
when 'pubsub' then send_pubsub_command(method, command, args, &block)
|
49
|
+
when 'watch' then send_watch_command(command, &block)
|
47
50
|
when 'acl', 'auth', 'bgrewriteaof', 'bgsave', 'quit', 'save'
|
48
51
|
@node.call_all(method, command, args).first.then(&TSF.call(block))
|
49
52
|
when 'flushall', 'flushdb'
|
@@ -308,6 +311,19 @@ class RedisClient
|
|
308
311
|
end
|
309
312
|
end
|
310
313
|
|
314
|
+
# for redis-rb
|
315
|
+
def send_watch_command(command)
|
316
|
+
raise ::RedisClient::Cluster::Transaction::ConsistencyError, 'A block required. And you need to use the block argument as a client for the transaction.' unless block_given?
|
317
|
+
|
318
|
+
::RedisClient::Cluster::OptimisticLocking.new(self).watch(command[1..]) do |c, slot|
|
319
|
+
transaction = ::RedisClient::Cluster::Transaction.new(
|
320
|
+
self, @command_builder, node: c, slot: slot
|
321
|
+
)
|
322
|
+
yield transaction
|
323
|
+
transaction.execute
|
324
|
+
end
|
325
|
+
end
|
326
|
+
|
311
327
|
def update_cluster_info!
|
312
328
|
@node.reload!
|
313
329
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: redis-cluster-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Taishi Kasuga
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-02-
|
11
|
+
date: 2024-02-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: redis-client
|