redis 5.0.8 → 5.1.0
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/CHANGELOG.md +6 -0
- data/lib/redis/client.rb +7 -7
- data/lib/redis/commands/bitmaps.rb +10 -3
- data/lib/redis/commands/keys.rb +16 -0
- data/lib/redis/distributed.rb +14 -4
- data/lib/redis/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ab20cee7f44b7d5f2736e1fbc7073cb950f52ceefc3dc1ff0edf9b4b778c7d8d
|
4
|
+
data.tar.gz: 76b0b6169311906b2ee634f9314c74052a1612245d7e33220aab5cb2c617af8a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 220927cf03b0ad6ab0c7340d9b32ed073e379974d054eba12cf966ad65837eba00f114d1fdeb166780ead645befcc3ee9fb3a83aab8e8cb0b1661370f401f8cb
|
7
|
+
data.tar.gz: 8f9476be4c7d4a3dd8dc1f29265b184932f67b49d524a0c79865dc95eee3ba165e9d24cb3f699ce287b886cc4f38b88574a5b33b1bab48f2fe9971597b7d2c5c
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
# Unreleased
|
2
2
|
|
3
|
+
# 5.1.0
|
4
|
+
|
5
|
+
- `multi` now accept a `watch` keyword argument like `redis-client`. See #1236.
|
6
|
+
- `bitcount` and `bitpos` now accept a `scale:` argument on Redis 7+. See #1242
|
7
|
+
- Added `expiretime` and `pexpiretime`. See #1248.
|
8
|
+
|
3
9
|
# 5.0.8
|
4
10
|
|
5
11
|
- Fix `Redis#without_reconnect` for sentinel clients. Fix #1212.
|
data/lib/redis/client.rb
CHANGED
@@ -27,18 +27,18 @@ class Redis
|
|
27
27
|
super(protocol: 2, **kwargs, client_implementation: ::RedisClient)
|
28
28
|
end
|
29
29
|
|
30
|
-
def translate_error!(error)
|
31
|
-
redis_error = translate_error_class(error.class)
|
30
|
+
def translate_error!(error, mapping: ERROR_MAPPING)
|
31
|
+
redis_error = translate_error_class(error.class, mapping: mapping)
|
32
32
|
raise redis_error, error.message, error.backtrace
|
33
33
|
end
|
34
34
|
|
35
35
|
private
|
36
36
|
|
37
|
-
def translate_error_class(error_class)
|
38
|
-
|
37
|
+
def translate_error_class(error_class, mapping: ERROR_MAPPING)
|
38
|
+
mapping.fetch(error_class)
|
39
39
|
rescue IndexError
|
40
|
-
if (client_error = error_class.ancestors.find { |a|
|
41
|
-
|
40
|
+
if (client_error = error_class.ancestors.find { |a| mapping[a] })
|
41
|
+
mapping[error_class] = mapping[client_error]
|
42
42
|
else
|
43
43
|
raise
|
44
44
|
end
|
@@ -111,7 +111,7 @@ class Redis
|
|
111
111
|
Client.translate_error!(error)
|
112
112
|
end
|
113
113
|
|
114
|
-
def multi
|
114
|
+
def multi(watch: nil)
|
115
115
|
super
|
116
116
|
rescue ::RedisClient::Error => error
|
117
117
|
Client.translate_error!(error)
|
@@ -27,9 +27,13 @@ class Redis
|
|
27
27
|
# @param [String] key
|
28
28
|
# @param [Integer] start start index
|
29
29
|
# @param [Integer] stop stop index
|
30
|
+
# @param [String, Symbol] scale the scale of the offset range
|
31
|
+
# e.g. 'BYTE' - interpreted as a range of bytes, 'BIT' - interpreted as a range of bits
|
30
32
|
# @return [Integer] the number of bits set to 1
|
31
|
-
def bitcount(key, start = 0, stop = -1)
|
32
|
-
|
33
|
+
def bitcount(key, start = 0, stop = -1, scale: nil)
|
34
|
+
command = [:bitcount, key, start, stop]
|
35
|
+
command << scale if scale
|
36
|
+
send_command(command)
|
33
37
|
end
|
34
38
|
|
35
39
|
# Perform a bitwise operation between strings and store the resulting string in a key.
|
@@ -51,14 +55,17 @@ class Redis
|
|
51
55
|
# @param [Integer] bit whether to look for the first 1 or 0 bit
|
52
56
|
# @param [Integer] start start index
|
53
57
|
# @param [Integer] stop stop index
|
58
|
+
# @param [String, Symbol] scale the scale of the offset range
|
59
|
+
# e.g. 'BYTE' - interpreted as a range of bytes, 'BIT' - interpreted as a range of bits
|
54
60
|
# @return [Integer] the position of the first 1/0 bit.
|
55
61
|
# -1 if looking for 1 and it is not found or start and stop are given.
|
56
|
-
def bitpos(key, bit, start = nil, stop = nil)
|
62
|
+
def bitpos(key, bit, start = nil, stop = nil, scale: nil)
|
57
63
|
raise(ArgumentError, 'stop parameter specified without start parameter') if stop && !start
|
58
64
|
|
59
65
|
command = [:bitpos, key, bit]
|
60
66
|
command << start if start
|
61
67
|
command << stop if stop
|
68
|
+
command << scale if scale
|
62
69
|
send_command(command)
|
63
70
|
end
|
64
71
|
end
|
data/lib/redis/commands/keys.rb
CHANGED
@@ -105,6 +105,14 @@ class Redis
|
|
105
105
|
send_command(args, &Boolify)
|
106
106
|
end
|
107
107
|
|
108
|
+
# Get a key's expiry time specified as number of seconds from UNIX Epoch
|
109
|
+
#
|
110
|
+
# @param [String] key
|
111
|
+
# @return [Integer] expiry time specified as number of seconds from UNIX Epoch
|
112
|
+
def expiretime(key)
|
113
|
+
send_command([:expiretime, key])
|
114
|
+
end
|
115
|
+
|
108
116
|
# Get the time to live (in seconds) for a key.
|
109
117
|
#
|
110
118
|
# @param [String] key
|
@@ -161,6 +169,14 @@ class Redis
|
|
161
169
|
send_command(args, &Boolify)
|
162
170
|
end
|
163
171
|
|
172
|
+
# Get a key's expiry time specified as number of milliseconds from UNIX Epoch
|
173
|
+
#
|
174
|
+
# @param [String] key
|
175
|
+
# @return [Integer] expiry time specified as number of milliseconds from UNIX Epoch
|
176
|
+
def pexpiretime(key)
|
177
|
+
send_command([:pexpiretime, key])
|
178
|
+
end
|
179
|
+
|
164
180
|
# Get the time to live (in milliseconds) for a key.
|
165
181
|
#
|
166
182
|
# @param [String] key
|
data/lib/redis/distributed.rb
CHANGED
@@ -130,6 +130,11 @@ class Redis
|
|
130
130
|
node_for(key).expireat(key, unix_time, **kwargs)
|
131
131
|
end
|
132
132
|
|
133
|
+
# Get the expiration for a key as a UNIX timestamp.
|
134
|
+
def expiretime(key)
|
135
|
+
node_for(key).expiretime(key)
|
136
|
+
end
|
137
|
+
|
133
138
|
# Get the time to live (in seconds) for a key.
|
134
139
|
def ttl(key)
|
135
140
|
node_for(key).ttl(key)
|
@@ -145,6 +150,11 @@ class Redis
|
|
145
150
|
node_for(key).pexpireat(key, ms_unix_time, **kwarg)
|
146
151
|
end
|
147
152
|
|
153
|
+
# Get the expiration for a key as number of milliseconds from UNIX Epoch.
|
154
|
+
def pexpiretime(key)
|
155
|
+
node_for(key).pexpiretime(key)
|
156
|
+
end
|
157
|
+
|
148
158
|
# Get the time to live (in milliseconds) for a key.
|
149
159
|
def pttl(key)
|
150
160
|
node_for(key).pttl(key)
|
@@ -370,8 +380,8 @@ class Redis
|
|
370
380
|
end
|
371
381
|
|
372
382
|
# Count the number of set bits in a range of the string value stored at key.
|
373
|
-
def bitcount(key, start = 0, stop = -1)
|
374
|
-
node_for(key).bitcount(key, start, stop)
|
383
|
+
def bitcount(key, start = 0, stop = -1, scale: nil)
|
384
|
+
node_for(key).bitcount(key, start, stop, scale: scale)
|
375
385
|
end
|
376
386
|
|
377
387
|
# Perform a bitwise operation between strings and store the resulting string in a key.
|
@@ -383,8 +393,8 @@ class Redis
|
|
383
393
|
end
|
384
394
|
|
385
395
|
# Return the position of the first bit set to 1 or 0 in a string.
|
386
|
-
def bitpos(key, bit, start = nil, stop = nil)
|
387
|
-
node_for(key).bitpos(key, bit, start, stop)
|
396
|
+
def bitpos(key, bit, start = nil, stop = nil, scale: nil)
|
397
|
+
node_for(key).bitpos(key, bit, start, stop, scale: scale)
|
388
398
|
end
|
389
399
|
|
390
400
|
# Set the string value of a key and return its old value.
|
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: 5.0
|
4
|
+
version: 5.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ezra Zygmuntowicz
|
@@ -16,7 +16,7 @@ authors:
|
|
16
16
|
autorequire:
|
17
17
|
bindir: bin
|
18
18
|
cert_chain: []
|
19
|
-
date:
|
19
|
+
date: 2024-02-09 00:00:00.000000000 Z
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
22
22
|
name: redis-client
|
@@ -75,9 +75,9 @@ licenses:
|
|
75
75
|
metadata:
|
76
76
|
bug_tracker_uri: https://github.com/redis/redis-rb/issues
|
77
77
|
changelog_uri: https://github.com/redis/redis-rb/blob/master/CHANGELOG.md
|
78
|
-
documentation_uri: https://www.rubydoc.info/gems/redis/5.0
|
78
|
+
documentation_uri: https://www.rubydoc.info/gems/redis/5.1.0
|
79
79
|
homepage_uri: https://github.com/redis/redis-rb
|
80
|
-
source_code_uri: https://github.com/redis/redis-rb/tree/v5.0
|
80
|
+
source_code_uri: https://github.com/redis/redis-rb/tree/v5.1.0
|
81
81
|
post_install_message:
|
82
82
|
rdoc_options: []
|
83
83
|
require_paths:
|