redis-cluster-client 0.7.9 → 0.7.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/redis_client/cluster/optimistic_locking.rb +3 -2
- data/lib/redis_client/cluster/router.rb +14 -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: b591c92886bf877147317dd04695d2d22354958443f83e386b061b45b0407b28
|
4
|
+
data.tar.gz: 40a46369e32c60a3c165aff646d3dbd53c3ef427fef6220d4bacc17fc6a97232
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0e8eda475d22314feb84d16c2d5d75dfe714abecf2c6482a7600c012d02705110c40a0ed7717029a7e8ad154040c6cd44978ffd6b9a2c0350ec33e45d1e1b81e
|
7
|
+
data.tar.gz: a8fc2bb1febdac9e44c23aaab93ddce567d9ea1fe4ff09f74aa3ebac7eba56efceff44b5f13fea0284d4bec8b2677bd58dfee0eedfebe9cdc4ed9e7d4f6cb6df
|
@@ -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,17 @@ class RedisClient
|
|
308
311
|
end
|
309
312
|
end
|
310
313
|
|
314
|
+
# for redis-rb
|
315
|
+
def send_watch_command(command)
|
316
|
+
::RedisClient::Cluster::OptimisticLocking.new(self).watch(command[1..]) do |c, slot|
|
317
|
+
transaction = ::RedisClient::Cluster::Transaction.new(
|
318
|
+
self, @command_builder, node: c, slot: slot
|
319
|
+
)
|
320
|
+
yield transaction
|
321
|
+
transaction.execute
|
322
|
+
end
|
323
|
+
end
|
324
|
+
|
311
325
|
def update_cluster_info!
|
312
326
|
@node.reload!
|
313
327
|
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.10
|
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
|