redis 4.2.1 → 4.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/lib/redis.rb +4 -1
- data/lib/redis/distributed.rb +37 -8
- data/lib/redis/version.rb +1 -1
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 28eb23d20152436fc47f334f517c6fa62855e8e4711b44979cb05d86f8dcdd34
|
4
|
+
data.tar.gz: 46d01b3f5539800142582aeb7ebeabe4327bce970e31ce2048dcba027dfe6eb1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f2f11269c6a3a030231eeb93dfa6bee54b340ff5ad244df6d79074c95f111e3d2081f49f77756576cb8225640e8b8cad144884c8519bcf1b0e7bedea3ca1b00f
|
7
|
+
data.tar.gz: 44ec06531632060b497cf1d02e6678c3d087ec3371cba86f53f9687848f73bb4e02c166b11d4db9e6b531b62ba2ca830649d71114063560f6dd764ca2ef10f07
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
# Unreleased
|
2
2
|
|
3
|
+
# 4.2.2
|
4
|
+
|
5
|
+
* Fix `WATCH` support for `Redis::Distributed`. See #941.
|
6
|
+
* Fix handling of empty stream responses. See #905, #929.
|
7
|
+
|
3
8
|
# 4.2.1
|
4
9
|
|
5
10
|
* Fix `exists?` returning an actual boolean when called with multiple keys. See #918.
|
@@ -17,6 +22,7 @@
|
|
17
22
|
* Optimized initialization of Redis::Cluster. See #912.
|
18
23
|
* Accept sentinel options even with string key. See #599.
|
19
24
|
* Verify TLS connections by default. See #900.
|
25
|
+
* Make `Redis#hset` variadic. It now returns an integer, not a boolean. See #910.
|
20
26
|
|
21
27
|
# 4.1.4
|
22
28
|
|
data/lib/redis.rb
CHANGED
@@ -3423,8 +3423,11 @@ class Redis
|
|
3423
3423
|
end
|
3424
3424
|
}
|
3425
3425
|
|
3426
|
+
EMPTY_STREAM_RESPONSE = [nil].freeze
|
3427
|
+
private_constant :EMPTY_STREAM_RESPONSE
|
3428
|
+
|
3426
3429
|
HashifyStreamEntries = lambda { |reply|
|
3427
|
-
reply.map do |entry_id, values|
|
3430
|
+
reply.compact.map do |entry_id, values|
|
3428
3431
|
[entry_id, values.each_slice(2).to_h]
|
3429
3432
|
end
|
3430
3433
|
}
|
data/lib/redis/distributed.rb
CHANGED
@@ -24,10 +24,14 @@ class Redis
|
|
24
24
|
@default_options = options.dup
|
25
25
|
node_configs.each { |node_config| add_node(node_config) }
|
26
26
|
@subscribed_node = nil
|
27
|
+
@watch_key = nil
|
27
28
|
end
|
28
29
|
|
29
30
|
def node_for(key)
|
30
|
-
|
31
|
+
key = key_tag(key.to_s) || key.to_s
|
32
|
+
raise CannotDistribute, :watch if @watch_key && @watch_key != key
|
33
|
+
|
34
|
+
@ring.get_node(key)
|
31
35
|
end
|
32
36
|
|
33
37
|
def nodes
|
@@ -799,13 +803,26 @@ class Redis
|
|
799
803
|
end
|
800
804
|
|
801
805
|
# Watch the given keys to determine execution of the MULTI/EXEC block.
|
802
|
-
def watch(*
|
803
|
-
|
806
|
+
def watch(*keys, &block)
|
807
|
+
ensure_same_node(:watch, keys) do |node|
|
808
|
+
@watch_key = key_tag(keys.first) || keys.first.to_s
|
809
|
+
|
810
|
+
begin
|
811
|
+
node.watch(*keys, &block)
|
812
|
+
rescue StandardError
|
813
|
+
@watch_key = nil
|
814
|
+
raise
|
815
|
+
end
|
816
|
+
end
|
804
817
|
end
|
805
818
|
|
806
819
|
# Forget about all watched keys.
|
807
820
|
def unwatch
|
808
|
-
raise CannotDistribute, :unwatch
|
821
|
+
raise CannotDistribute, :unwatch unless @watch_key
|
822
|
+
|
823
|
+
result = node_for(@watch_key).unwatch
|
824
|
+
@watch_key = nil
|
825
|
+
result
|
809
826
|
end
|
810
827
|
|
811
828
|
def pipelined
|
@@ -813,18 +830,30 @@ class Redis
|
|
813
830
|
end
|
814
831
|
|
815
832
|
# Mark the start of a transaction block.
|
816
|
-
def multi
|
817
|
-
raise CannotDistribute, :multi
|
833
|
+
def multi(&block)
|
834
|
+
raise CannotDistribute, :multi unless @watch_key
|
835
|
+
|
836
|
+
result = node_for(@watch_key).multi(&block)
|
837
|
+
@watch_key = nil if block_given?
|
838
|
+
result
|
818
839
|
end
|
819
840
|
|
820
841
|
# Execute all commands issued after MULTI.
|
821
842
|
def exec
|
822
|
-
raise CannotDistribute, :exec
|
843
|
+
raise CannotDistribute, :exec unless @watch_key
|
844
|
+
|
845
|
+
result = node_for(@watch_key).exec
|
846
|
+
@watch_key = nil
|
847
|
+
result
|
823
848
|
end
|
824
849
|
|
825
850
|
# Discard all commands issued after MULTI.
|
826
851
|
def discard
|
827
|
-
raise CannotDistribute, :discard
|
852
|
+
raise CannotDistribute, :discard unless @watch_key
|
853
|
+
|
854
|
+
result = node_for(@watch_key).discard
|
855
|
+
@watch_key = nil
|
856
|
+
result
|
828
857
|
end
|
829
858
|
|
830
859
|
# Control remote script registry.
|
data/lib/redis/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: redis
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.2.
|
4
|
+
version: 4.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ezra Zygmuntowicz
|
@@ -13,10 +13,10 @@ authors:
|
|
13
13
|
- Michel Martens
|
14
14
|
- Damian Janowski
|
15
15
|
- Pieter Noordhuis
|
16
|
-
autorequire:
|
16
|
+
autorequire:
|
17
17
|
bindir: bin
|
18
18
|
cert_chain: []
|
19
|
-
date: 2020-
|
19
|
+
date: 2020-09-07 00:00:00.000000000 Z
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
22
22
|
name: em-synchrony
|
@@ -102,10 +102,10 @@ licenses:
|
|
102
102
|
metadata:
|
103
103
|
bug_tracker_uri: https://github.com/redis/redis-rb/issues
|
104
104
|
changelog_uri: https://github.com/redis/redis-rb/blob/master/CHANGELOG.md
|
105
|
-
documentation_uri: https://www.rubydoc.info/gems/redis/4.2.
|
105
|
+
documentation_uri: https://www.rubydoc.info/gems/redis/4.2.2
|
106
106
|
homepage_uri: https://github.com/redis/redis-rb
|
107
|
-
source_code_uri: https://github.com/redis/redis-rb/tree/v4.2.
|
108
|
-
post_install_message:
|
107
|
+
source_code_uri: https://github.com/redis/redis-rb/tree/v4.2.2
|
108
|
+
post_install_message:
|
109
109
|
rdoc_options: []
|
110
110
|
require_paths:
|
111
111
|
- lib
|
@@ -120,8 +120,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
120
120
|
- !ruby/object:Gem::Version
|
121
121
|
version: '0'
|
122
122
|
requirements: []
|
123
|
-
rubygems_version: 3.
|
124
|
-
signing_key:
|
123
|
+
rubygems_version: 3.1.2
|
124
|
+
signing_key:
|
125
125
|
specification_version: 4
|
126
126
|
summary: A Ruby client library for Redis
|
127
127
|
test_files: []
|