redis-promise 0.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 +7 -0
- data/.github/workflows/ci.yml +74 -0
- data/CHANGELOG.md +19 -0
- data/LICENSE +21 -0
- data/README.md +151 -0
- data/Rakefile +12 -0
- data/lib/redis/promise/resolver.rb +47 -0
- data/lib/redis/promise/resque.rb +49 -0
- data/lib/redis/promise/version.rb +8 -0
- data/lib/redis/promise.rb +83 -0
- data/sorbet/config +7 -0
- data/sorbet/rbi/annotations/.gitattributes +1 -0
- data/sorbet/rbi/annotations/minitest.rbi +120 -0
- data/sorbet/rbi/annotations/rainbow.rbi +269 -0
- data/sorbet/rbi/gems/.gitattributes +1 -0
- data/sorbet/rbi/gems/ast@2.4.3.rbi +586 -0
- data/sorbet/rbi/gems/byebug@13.0.0.rbi +37 -0
- data/sorbet/rbi/gems/connection_pool@3.0.2.rbi +340 -0
- data/sorbet/rbi/gems/date@3.5.1.rbi +403 -0
- data/sorbet/rbi/gems/erb@6.0.4.rbi +814 -0
- data/sorbet/rbi/gems/io-console@0.8.2.rbi +9 -0
- data/sorbet/rbi/gems/json@2.19.5.rbi +2250 -0
- data/sorbet/rbi/gems/lint_roller@1.1.0.rbi +323 -0
- data/sorbet/rbi/gems/minitest@5.27.0.rbi +1549 -0
- data/sorbet/rbi/gems/parallel@2.1.0.rbi +359 -0
- data/sorbet/rbi/gems/pp@0.6.3.rbi +388 -0
- data/sorbet/rbi/gems/prettyprint@0.2.0.rbi +477 -0
- data/sorbet/rbi/gems/psych@5.3.1.rbi +2555 -0
- data/sorbet/rbi/gems/racc@1.8.1.rbi +168 -0
- data/sorbet/rbi/gems/rainbow@3.1.1.rbi +403 -0
- data/sorbet/rbi/gems/rake@13.4.2.rbi +3258 -0
- data/sorbet/rbi/gems/redis-client@0.29.0.rbi +1203 -0
- data/sorbet/rbi/gems/redis@5.4.1.rbi +3552 -0
- data/sorbet/rbi/gems/reline@0.6.3.rbi +2995 -0
- data/sorbet/rbi/gems/rubocop-espago@1.2.0.rbi +9 -0
- data/sorbet/rbi/gems/ruby-progressbar@1.13.0.rbi +1318 -0
- data/sorbet/rbi/gems/shoulda-context@2.0.0.rbi +563 -0
- data/sorbet/rbi/gems/stringio@3.2.0.rbi +9 -0
- data/sorbet/rbi/gems/tsort@0.2.0.rbi +393 -0
- data/sorbet/rbi/gems/unicode-display_width@3.2.0.rbi +132 -0
- data/sorbet/rbi/gems/unicode-emoji@4.2.0.rbi +254 -0
- data/sorbet/rbi/shims/gems/resque.rbi +9 -0
- data/sorbet/rbi/shims/gems/shoulda-context.rbi +16 -0
- data/sorbet/rbi/todo.rbi +5 -0
- data/sorbet/tapioca/config.yml +31 -0
- data/sorbet/tapioca/extensions/load_gem.rb +1 -0
- data/sorbet/tapioca/require.rb +5 -0
- metadata +117 -0
|
@@ -0,0 +1,3552 @@
|
|
|
1
|
+
# typed: true
|
|
2
|
+
|
|
3
|
+
# DO NOT EDIT MANUALLY
|
|
4
|
+
# This is an autogenerated file for types exported from the `redis` gem.
|
|
5
|
+
# Please instead update this file by running `bin/tapioca gem redis`.
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
# pkg:gem/redis#lib/redis/errors.rb:3
|
|
9
|
+
class Redis
|
|
10
|
+
include ::Redis::Commands::Bitmaps
|
|
11
|
+
include ::Redis::Commands::Cluster
|
|
12
|
+
include ::Redis::Commands::Connection
|
|
13
|
+
include ::Redis::Commands::Geo
|
|
14
|
+
include ::Redis::Commands::Hashes
|
|
15
|
+
include ::Redis::Commands::HyperLogLog
|
|
16
|
+
include ::Redis::Commands::Keys
|
|
17
|
+
include ::Redis::Commands::Lists
|
|
18
|
+
include ::Redis::Commands::Pubsub
|
|
19
|
+
include ::Redis::Commands::Scripting
|
|
20
|
+
include ::Redis::Commands::Server
|
|
21
|
+
include ::Redis::Commands::Sets
|
|
22
|
+
include ::Redis::Commands::SortedSets
|
|
23
|
+
include ::Redis::Commands::Streams
|
|
24
|
+
include ::Redis::Commands::Strings
|
|
25
|
+
include ::Redis::Commands::Transactions
|
|
26
|
+
include ::Redis::Commands
|
|
27
|
+
|
|
28
|
+
# Create a new client instance
|
|
29
|
+
#
|
|
30
|
+
# @param [Hash] options
|
|
31
|
+
# @option options [String] :url (value of the environment variable REDIS_URL) a Redis URL, for a TCP connection:
|
|
32
|
+
# `redis://:[password]@[hostname]:[port]/[db]` (password, port and database are optional), for a unix socket
|
|
33
|
+
# connection: `unix://[path to Redis socket]`. This overrides all other options.
|
|
34
|
+
# @option options [String] :host ("127.0.0.1") server hostname
|
|
35
|
+
# @option options [Integer] :port (6379) server port
|
|
36
|
+
# @option options [String] :path path to server socket (overrides host and port)
|
|
37
|
+
# @option options [Float] :timeout (1.0) timeout in seconds
|
|
38
|
+
# @option options [Float] :connect_timeout (same as timeout) timeout for initial connect in seconds
|
|
39
|
+
# @option options [String] :username Username to authenticate against server
|
|
40
|
+
# @option options [String] :password Password to authenticate against server
|
|
41
|
+
# @option options [Integer] :db (0) Database to select after connect and on reconnects
|
|
42
|
+
# @option options [Symbol] :driver Driver to use, currently supported: `:ruby`, `:hiredis`
|
|
43
|
+
# @option options [String] :id ID for the client connection, assigns name to current connection by sending
|
|
44
|
+
# `CLIENT SETNAME`
|
|
45
|
+
# @option options [Integer, Array<Integer, Float>] :reconnect_attempts Number of attempts trying to connect,
|
|
46
|
+
# or a list of sleep duration between attempts.
|
|
47
|
+
# @option options [Boolean] :inherit_socket (false) Whether to use socket in forked process or not
|
|
48
|
+
# @option options [String] :name The name of the server group to connect to.
|
|
49
|
+
# @option options [Array] :sentinels List of sentinels to contact
|
|
50
|
+
#
|
|
51
|
+
# @return [Redis] a new client instance
|
|
52
|
+
#
|
|
53
|
+
# pkg:gem/redis#lib/redis.rb:65
|
|
54
|
+
def initialize(options = T.unsafe(nil)); end
|
|
55
|
+
|
|
56
|
+
# pkg:gem/redis#lib/redis.rb:100
|
|
57
|
+
def _client; end
|
|
58
|
+
|
|
59
|
+
# Disconnect the client as quickly and silently as possible.
|
|
60
|
+
#
|
|
61
|
+
# pkg:gem/redis#lib/redis.rb:90
|
|
62
|
+
def close; end
|
|
63
|
+
|
|
64
|
+
# Test whether or not the client is connected
|
|
65
|
+
#
|
|
66
|
+
# pkg:gem/redis#lib/redis.rb:85
|
|
67
|
+
def connected?; end
|
|
68
|
+
|
|
69
|
+
# pkg:gem/redis#lib/redis.rb:124
|
|
70
|
+
def connection; end
|
|
71
|
+
|
|
72
|
+
# pkg:gem/redis#lib/redis.rb:94
|
|
73
|
+
def disconnect!; end
|
|
74
|
+
|
|
75
|
+
# pkg:gem/redis#lib/redis.rb:120
|
|
76
|
+
def dup; end
|
|
77
|
+
|
|
78
|
+
# pkg:gem/redis#lib/redis.rb:112
|
|
79
|
+
def id; end
|
|
80
|
+
|
|
81
|
+
# pkg:gem/redis#lib/redis.rb:116
|
|
82
|
+
def inspect; end
|
|
83
|
+
|
|
84
|
+
# pkg:gem/redis#lib/redis.rb:104
|
|
85
|
+
def pipelined(exception: T.unsafe(nil)); end
|
|
86
|
+
|
|
87
|
+
# pkg:gem/redis#lib/redis.rb:96
|
|
88
|
+
def with; end
|
|
89
|
+
|
|
90
|
+
# Run code without the client reconnecting
|
|
91
|
+
#
|
|
92
|
+
# pkg:gem/redis#lib/redis.rb:80
|
|
93
|
+
def without_reconnect(&block); end
|
|
94
|
+
|
|
95
|
+
private
|
|
96
|
+
|
|
97
|
+
# pkg:gem/redis#lib/redis.rb:166
|
|
98
|
+
def _subscription(method, timeout, channels, block); end
|
|
99
|
+
|
|
100
|
+
# pkg:gem/redis#lib/redis.rb:136
|
|
101
|
+
def initialize_client(options); end
|
|
102
|
+
|
|
103
|
+
# pkg:gem/redis#lib/redis.rb:160
|
|
104
|
+
def send_blocking_command(command, timeout, &block); end
|
|
105
|
+
|
|
106
|
+
# pkg:gem/redis#lib/redis.rb:152
|
|
107
|
+
def send_command(command, &block); end
|
|
108
|
+
|
|
109
|
+
# pkg:gem/redis#lib/redis.rb:148
|
|
110
|
+
def synchronize; end
|
|
111
|
+
|
|
112
|
+
class << self
|
|
113
|
+
# pkg:gem/redis#lib/redis.rb:16
|
|
114
|
+
def deprecate!(message); end
|
|
115
|
+
|
|
116
|
+
# pkg:gem/redis#lib/redis.rb:14
|
|
117
|
+
def raise_deprecations; end
|
|
118
|
+
|
|
119
|
+
# pkg:gem/redis#lib/redis.rb:14
|
|
120
|
+
def raise_deprecations=(_arg0); end
|
|
121
|
+
|
|
122
|
+
# pkg:gem/redis#lib/redis.rb:14
|
|
123
|
+
def silence_deprecations; end
|
|
124
|
+
|
|
125
|
+
# pkg:gem/redis#lib/redis.rb:14
|
|
126
|
+
def silence_deprecations=(_arg0); end
|
|
127
|
+
end
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
# pkg:gem/redis#lib/redis.rb:10
|
|
131
|
+
Redis::BASE_PATH = T.let(T.unsafe(nil), String)
|
|
132
|
+
|
|
133
|
+
# Base error for connection related errors.
|
|
134
|
+
#
|
|
135
|
+
# pkg:gem/redis#lib/redis/errors.rb:38
|
|
136
|
+
class Redis::BaseConnectionError < ::Redis::BaseError; end
|
|
137
|
+
|
|
138
|
+
# Base error for all redis-rb errors.
|
|
139
|
+
#
|
|
140
|
+
# pkg:gem/redis#lib/redis/errors.rb:5
|
|
141
|
+
class Redis::BaseError < ::StandardError; end
|
|
142
|
+
|
|
143
|
+
# Raised when connection to a Redis server cannot be made.
|
|
144
|
+
#
|
|
145
|
+
# pkg:gem/redis#lib/redis/errors.rb:42
|
|
146
|
+
class Redis::CannotConnectError < ::Redis::BaseConnectionError; end
|
|
147
|
+
|
|
148
|
+
# pkg:gem/redis#lib/redis/client.rb:4
|
|
149
|
+
class Redis::Client < ::RedisClient
|
|
150
|
+
# pkg:gem/redis#lib/redis/client.rb:102
|
|
151
|
+
def blocking_call_v(timeout, command, &block); end
|
|
152
|
+
|
|
153
|
+
# pkg:gem/redis#lib/redis/client.rb:96
|
|
154
|
+
def call_v(command, &block); end
|
|
155
|
+
|
|
156
|
+
# pkg:gem/redis#lib/redis/client.rb:61
|
|
157
|
+
def db; end
|
|
158
|
+
|
|
159
|
+
# pkg:gem/redis#lib/redis/client.rb:90
|
|
160
|
+
def ensure_connected(retryable: T.unsafe(nil), &block); end
|
|
161
|
+
|
|
162
|
+
# pkg:gem/redis#lib/redis/client.rb:65
|
|
163
|
+
def host; end
|
|
164
|
+
|
|
165
|
+
# pkg:gem/redis#lib/redis/client.rb:49
|
|
166
|
+
def id; end
|
|
167
|
+
|
|
168
|
+
# pkg:gem/redis#lib/redis/client.rb:127
|
|
169
|
+
def inherit_socket!; end
|
|
170
|
+
|
|
171
|
+
# pkg:gem/redis#lib/redis/client.rb:121
|
|
172
|
+
def multi(watch: T.unsafe(nil)); end
|
|
173
|
+
|
|
174
|
+
# pkg:gem/redis#lib/redis/client.rb:81
|
|
175
|
+
def password; end
|
|
176
|
+
|
|
177
|
+
# pkg:gem/redis#lib/redis/client.rb:73
|
|
178
|
+
def path; end
|
|
179
|
+
|
|
180
|
+
# pkg:gem/redis#lib/redis/client.rb:115
|
|
181
|
+
def pipelined(exception: T.unsafe(nil)); end
|
|
182
|
+
|
|
183
|
+
# pkg:gem/redis#lib/redis/client.rb:69
|
|
184
|
+
def port; end
|
|
185
|
+
|
|
186
|
+
# pkg:gem/redis#lib/redis/client.rb:53
|
|
187
|
+
def server_url; end
|
|
188
|
+
|
|
189
|
+
# pkg:gem/redis#lib/redis/client.rb:57
|
|
190
|
+
def timeout; end
|
|
191
|
+
|
|
192
|
+
# pkg:gem/redis#lib/redis/client.rb:77
|
|
193
|
+
def username; end
|
|
194
|
+
|
|
195
|
+
class << self
|
|
196
|
+
# pkg:gem/redis#lib/redis/client.rb:23
|
|
197
|
+
def config(**kwargs); end
|
|
198
|
+
|
|
199
|
+
# pkg:gem/redis#lib/redis/client.rb:27
|
|
200
|
+
def sentinel(**kwargs); end
|
|
201
|
+
|
|
202
|
+
# pkg:gem/redis#lib/redis/client.rb:31
|
|
203
|
+
def translate_error!(error, mapping: T.unsafe(nil)); end
|
|
204
|
+
|
|
205
|
+
private
|
|
206
|
+
|
|
207
|
+
# pkg:gem/redis#lib/redis/client.rb:38
|
|
208
|
+
def translate_error_class(error_class, mapping: T.unsafe(nil)); end
|
|
209
|
+
end
|
|
210
|
+
end
|
|
211
|
+
|
|
212
|
+
# pkg:gem/redis#lib/redis/client.rb:5
|
|
213
|
+
Redis::Client::ERROR_MAPPING = T.let(T.unsafe(nil), Hash)
|
|
214
|
+
|
|
215
|
+
# Raised by the client when command execution returns an error reply.
|
|
216
|
+
#
|
|
217
|
+
# pkg:gem/redis#lib/redis/errors.rb:20
|
|
218
|
+
class Redis::CommandError < ::Redis::BaseError; end
|
|
219
|
+
|
|
220
|
+
# pkg:gem/redis#lib/redis/commands/bitmaps.rb:4
|
|
221
|
+
module Redis::Commands
|
|
222
|
+
include ::Redis::Commands::Bitmaps
|
|
223
|
+
include ::Redis::Commands::Cluster
|
|
224
|
+
include ::Redis::Commands::Connection
|
|
225
|
+
include ::Redis::Commands::Geo
|
|
226
|
+
include ::Redis::Commands::Hashes
|
|
227
|
+
include ::Redis::Commands::HyperLogLog
|
|
228
|
+
include ::Redis::Commands::Keys
|
|
229
|
+
include ::Redis::Commands::Lists
|
|
230
|
+
include ::Redis::Commands::Pubsub
|
|
231
|
+
include ::Redis::Commands::Scripting
|
|
232
|
+
include ::Redis::Commands::Server
|
|
233
|
+
include ::Redis::Commands::Sets
|
|
234
|
+
include ::Redis::Commands::SortedSets
|
|
235
|
+
include ::Redis::Commands::Streams
|
|
236
|
+
include ::Redis::Commands::Strings
|
|
237
|
+
include ::Redis::Commands::Transactions
|
|
238
|
+
|
|
239
|
+
# Sends a command to Redis and returns its reply.
|
|
240
|
+
#
|
|
241
|
+
# Replies are converted to Ruby objects according to the RESP protocol, so
|
|
242
|
+
# you can expect a Ruby array, integer or nil when Redis sends one. Higher
|
|
243
|
+
# level transformations, such as converting an array of pairs into a Ruby
|
|
244
|
+
# hash, are up to consumers.
|
|
245
|
+
#
|
|
246
|
+
# Redis error replies are raised as Ruby exceptions.
|
|
247
|
+
#
|
|
248
|
+
# pkg:gem/redis#lib/redis/commands.rb:204
|
|
249
|
+
def call(*command, &block); end
|
|
250
|
+
|
|
251
|
+
# Interact with the sentinel command (masters, master, slaves, failover)
|
|
252
|
+
#
|
|
253
|
+
# @param [String] subcommand e.g. `masters`, `master`, `slaves`
|
|
254
|
+
# @param [Array<String>] args depends on subcommand
|
|
255
|
+
# @return [Array<String>, Hash<String, String>, String] depends on subcommand
|
|
256
|
+
#
|
|
257
|
+
# pkg:gem/redis#lib/redis/commands.rb:213
|
|
258
|
+
def sentinel(subcommand, *args); end
|
|
259
|
+
|
|
260
|
+
private
|
|
261
|
+
|
|
262
|
+
# pkg:gem/redis#lib/redis/commands.rb:235
|
|
263
|
+
def method_missing(*command); end
|
|
264
|
+
end
|
|
265
|
+
|
|
266
|
+
# pkg:gem/redis#lib/redis/commands/bitmaps.rb:5
|
|
267
|
+
module Redis::Commands::Bitmaps
|
|
268
|
+
# Count the number of set bits in a range of the string value stored at key.
|
|
269
|
+
#
|
|
270
|
+
# @param [String] key
|
|
271
|
+
# @param [Integer] start start index
|
|
272
|
+
# @param [Integer] stop stop index
|
|
273
|
+
# @param [String, Symbol] scale the scale of the offset range
|
|
274
|
+
# e.g. 'BYTE' - interpreted as a range of bytes, 'BIT' - interpreted as a range of bits
|
|
275
|
+
# @return [Integer] the number of bits set to 1
|
|
276
|
+
#
|
|
277
|
+
# pkg:gem/redis#lib/redis/commands/bitmaps.rb:33
|
|
278
|
+
def bitcount(key, start = T.unsafe(nil), stop = T.unsafe(nil), scale: T.unsafe(nil)); end
|
|
279
|
+
|
|
280
|
+
# Perform a bitwise operation between strings and store the resulting string in a key.
|
|
281
|
+
#
|
|
282
|
+
# @param [String] operation e.g. `and`, `or`, `xor`, `not`
|
|
283
|
+
# @param [String] destkey destination key
|
|
284
|
+
# @param [String, Array<String>] keys one or more source keys to perform `operation`
|
|
285
|
+
# @return [Integer] the length of the string stored in `destkey`
|
|
286
|
+
#
|
|
287
|
+
# pkg:gem/redis#lib/redis/commands/bitmaps.rb:45
|
|
288
|
+
def bitop(operation, destkey, *keys); end
|
|
289
|
+
|
|
290
|
+
# Return the position of the first bit set to 1 or 0 in a string.
|
|
291
|
+
#
|
|
292
|
+
# @param [String] key
|
|
293
|
+
# @param [Integer] bit whether to look for the first 1 or 0 bit
|
|
294
|
+
# @param [Integer] start start index
|
|
295
|
+
# @param [Integer] stop stop index
|
|
296
|
+
# @param [String, Symbol] scale the scale of the offset range
|
|
297
|
+
# e.g. 'BYTE' - interpreted as a range of bytes, 'BIT' - interpreted as a range of bits
|
|
298
|
+
# @return [Integer] the position of the first 1/0 bit.
|
|
299
|
+
# -1 if looking for 1 and it is not found or start and stop are given.
|
|
300
|
+
#
|
|
301
|
+
# pkg:gem/redis#lib/redis/commands/bitmaps.rb:62
|
|
302
|
+
def bitpos(key, bit, start = T.unsafe(nil), stop = T.unsafe(nil), scale: T.unsafe(nil)); end
|
|
303
|
+
|
|
304
|
+
# Returns the bit value at offset in the string value stored at key.
|
|
305
|
+
#
|
|
306
|
+
# @param [String] key
|
|
307
|
+
# @param [Integer] offset bit offset
|
|
308
|
+
# @return [Integer] `0` or `1`
|
|
309
|
+
#
|
|
310
|
+
# pkg:gem/redis#lib/redis/commands/bitmaps.rb:21
|
|
311
|
+
def getbit(key, offset); end
|
|
312
|
+
|
|
313
|
+
# Sets or clears the bit at offset in the string value stored at key.
|
|
314
|
+
#
|
|
315
|
+
# @param [String] key
|
|
316
|
+
# @param [Integer] offset bit offset
|
|
317
|
+
# @param [Integer] value bit value `0` or `1`
|
|
318
|
+
# @return [Integer] the original bit value stored at `offset`
|
|
319
|
+
#
|
|
320
|
+
# pkg:gem/redis#lib/redis/commands/bitmaps.rb:12
|
|
321
|
+
def setbit(key, offset, value); end
|
|
322
|
+
end
|
|
323
|
+
|
|
324
|
+
# Commands returning 1 for true and 0 for false may be executed in a pipeline
|
|
325
|
+
# where the method call will return nil. Propagate the nil instead of falsely
|
|
326
|
+
# returning false.
|
|
327
|
+
#
|
|
328
|
+
# pkg:gem/redis#lib/redis/commands.rb:42
|
|
329
|
+
Redis::Commands::Boolify = T.let(T.unsafe(nil), Proc)
|
|
330
|
+
|
|
331
|
+
# pkg:gem/redis#lib/redis/commands.rb:46
|
|
332
|
+
Redis::Commands::BoolifySet = T.let(T.unsafe(nil), Proc)
|
|
333
|
+
|
|
334
|
+
# pkg:gem/redis#lib/redis/commands/cluster.rb:5
|
|
335
|
+
module Redis::Commands::Cluster
|
|
336
|
+
# Sends `ASKING` command to random node and returns its reply.
|
|
337
|
+
#
|
|
338
|
+
# @see https://redis.io/topics/cluster-spec#ask-redirection ASK redirection
|
|
339
|
+
#
|
|
340
|
+
# @return [String] `'OK'`
|
|
341
|
+
#
|
|
342
|
+
# pkg:gem/redis#lib/redis/commands/cluster.rb:23
|
|
343
|
+
def asking; end
|
|
344
|
+
|
|
345
|
+
# Sends `CLUSTER *` command to random node and returns its reply.
|
|
346
|
+
#
|
|
347
|
+
# @see https://redis.io/commands#cluster Reference of cluster command
|
|
348
|
+
#
|
|
349
|
+
# @param subcommand [String, Symbol] the subcommand of cluster command
|
|
350
|
+
# e.g. `:slots`, `:nodes`, `:slaves`, `:info`
|
|
351
|
+
#
|
|
352
|
+
# @return [Object] depends on the subcommand
|
|
353
|
+
#
|
|
354
|
+
# pkg:gem/redis#lib/redis/commands/cluster.rb:14
|
|
355
|
+
def cluster(subcommand, *args); end
|
|
356
|
+
end
|
|
357
|
+
|
|
358
|
+
# pkg:gem/redis#lib/redis/commands/connection.rb:5
|
|
359
|
+
module Redis::Commands::Connection
|
|
360
|
+
# Authenticate to the server.
|
|
361
|
+
#
|
|
362
|
+
# @param [Array<String>] args includes both username and password
|
|
363
|
+
# or only password
|
|
364
|
+
# @return [String] `OK`
|
|
365
|
+
# @see https://redis.io/commands/auth AUTH command
|
|
366
|
+
#
|
|
367
|
+
# pkg:gem/redis#lib/redis/commands/connection.rb:12
|
|
368
|
+
def auth(*args); end
|
|
369
|
+
|
|
370
|
+
# Echo the given string.
|
|
371
|
+
#
|
|
372
|
+
# @param [String] value
|
|
373
|
+
# @return [String]
|
|
374
|
+
#
|
|
375
|
+
# pkg:gem/redis#lib/redis/commands/connection.rb:28
|
|
376
|
+
def echo(value); end
|
|
377
|
+
|
|
378
|
+
# Ping the server.
|
|
379
|
+
#
|
|
380
|
+
# @param [optional, String] message
|
|
381
|
+
# @return [String] `PONG`
|
|
382
|
+
#
|
|
383
|
+
# pkg:gem/redis#lib/redis/commands/connection.rb:20
|
|
384
|
+
def ping(message = T.unsafe(nil)); end
|
|
385
|
+
|
|
386
|
+
# Close the connection.
|
|
387
|
+
#
|
|
388
|
+
# @return [String] `OK`
|
|
389
|
+
#
|
|
390
|
+
# pkg:gem/redis#lib/redis/commands/connection.rb:43
|
|
391
|
+
def quit; end
|
|
392
|
+
|
|
393
|
+
# Change the selected database for the current connection.
|
|
394
|
+
#
|
|
395
|
+
# @param [Integer] db zero-based index of the DB to use (0 to 15)
|
|
396
|
+
# @return [String] `OK`
|
|
397
|
+
#
|
|
398
|
+
# pkg:gem/redis#lib/redis/commands/connection.rb:36
|
|
399
|
+
def select(db); end
|
|
400
|
+
end
|
|
401
|
+
|
|
402
|
+
# pkg:gem/redis#lib/redis/commands.rb:112
|
|
403
|
+
Redis::Commands::EMPTY_STREAM_RESPONSE = T.let(T.unsafe(nil), Array)
|
|
404
|
+
|
|
405
|
+
# pkg:gem/redis#lib/redis/commands.rb:73
|
|
406
|
+
Redis::Commands::Floatify = T.let(T.unsafe(nil), Proc)
|
|
407
|
+
|
|
408
|
+
# pkg:gem/redis#lib/redis/commands.rb:86
|
|
409
|
+
Redis::Commands::FloatifyPair = T.let(T.unsafe(nil), Proc)
|
|
410
|
+
|
|
411
|
+
# pkg:gem/redis#lib/redis/commands.rb:90
|
|
412
|
+
Redis::Commands::FloatifyPairs = T.let(T.unsafe(nil), Proc)
|
|
413
|
+
|
|
414
|
+
# pkg:gem/redis#lib/redis/commands/geo.rb:5
|
|
415
|
+
module Redis::Commands::Geo
|
|
416
|
+
# Adds the specified geospatial items (latitude, longitude, name) to the specified key
|
|
417
|
+
#
|
|
418
|
+
# @param [String] key
|
|
419
|
+
# @param [Array] member arguemnts for member or members: longitude, latitude, name
|
|
420
|
+
# @return [Integer] number of elements added to the sorted set
|
|
421
|
+
#
|
|
422
|
+
# pkg:gem/redis#lib/redis/commands/geo.rb:11
|
|
423
|
+
def geoadd(key, *member); end
|
|
424
|
+
|
|
425
|
+
# Returns the distance between two members of a geospatial index
|
|
426
|
+
#
|
|
427
|
+
# @param [String ]key
|
|
428
|
+
# @param [Array<String>] members
|
|
429
|
+
# @param ['m', 'km', 'mi', 'ft'] unit
|
|
430
|
+
# @return [String, nil] returns distance in spefied unit if both members present, nil otherwise.
|
|
431
|
+
#
|
|
432
|
+
# pkg:gem/redis#lib/redis/commands/geo.rb:70
|
|
433
|
+
def geodist(key, member1, member2, unit = T.unsafe(nil)); end
|
|
434
|
+
|
|
435
|
+
# Returns geohash string representing position for specified members of the specified key.
|
|
436
|
+
#
|
|
437
|
+
# @param [String] key
|
|
438
|
+
# @param [String, Array<String>] member one member or array of members
|
|
439
|
+
# @return [Array<String, nil>] returns array containg geohash string if member is present, nil otherwise
|
|
440
|
+
#
|
|
441
|
+
# pkg:gem/redis#lib/redis/commands/geo.rb:20
|
|
442
|
+
def geohash(key, member); end
|
|
443
|
+
|
|
444
|
+
# Returns longitude and latitude of members of a geospatial index
|
|
445
|
+
#
|
|
446
|
+
# @param [String] key
|
|
447
|
+
# @param [String, Array<String>] member one member or array of members
|
|
448
|
+
# @return [Array<Array<String>, nil>] returns array of elements, where each
|
|
449
|
+
# element is either array of longitude and latitude or nil
|
|
450
|
+
#
|
|
451
|
+
# pkg:gem/redis#lib/redis/commands/geo.rb:60
|
|
452
|
+
def geopos(key, member); end
|
|
453
|
+
|
|
454
|
+
# Query a sorted set representing a geospatial index to fetch members matching a
|
|
455
|
+
# given maximum distance from a point
|
|
456
|
+
#
|
|
457
|
+
# @param [Array] args key, longitude, latitude, radius, unit(m|km|ft|mi)
|
|
458
|
+
# @param ['asc', 'desc'] sort sort returned items from the nearest to the farthest
|
|
459
|
+
# or the farthest to the nearest relative to the center
|
|
460
|
+
# @param [Integer] count limit the results to the first N matching items
|
|
461
|
+
# @param ['WITHDIST', 'WITHCOORD', 'WITHHASH'] options to return additional information
|
|
462
|
+
# @return [Array<String>] may be changed with `options`
|
|
463
|
+
#
|
|
464
|
+
# pkg:gem/redis#lib/redis/commands/geo.rb:33
|
|
465
|
+
def georadius(*args, **geoptions); end
|
|
466
|
+
|
|
467
|
+
# Query a sorted set representing a geospatial index to fetch members matching a
|
|
468
|
+
# given maximum distance from an already existing member
|
|
469
|
+
#
|
|
470
|
+
# @param [Array] args key, member, radius, unit(m|km|ft|mi)
|
|
471
|
+
# @param ['asc', 'desc'] sort sort returned items from the nearest to the farthest or the farthest
|
|
472
|
+
# to the nearest relative to the center
|
|
473
|
+
# @param [Integer] count limit the results to the first N matching items
|
|
474
|
+
# @param ['WITHDIST', 'WITHCOORD', 'WITHHASH'] options to return additional information
|
|
475
|
+
# @return [Array<String>] may be changed with `options`
|
|
476
|
+
#
|
|
477
|
+
# pkg:gem/redis#lib/redis/commands/geo.rb:48
|
|
478
|
+
def georadiusbymember(*args, **geoptions); end
|
|
479
|
+
|
|
480
|
+
private
|
|
481
|
+
|
|
482
|
+
# pkg:gem/redis#lib/redis/commands/geo.rb:76
|
|
483
|
+
def _geoarguments(*args, options: T.unsafe(nil), sort: T.unsafe(nil), count: T.unsafe(nil)); end
|
|
484
|
+
end
|
|
485
|
+
|
|
486
|
+
# pkg:gem/redis#lib/redis/commands/hashes.rb:5
|
|
487
|
+
module Redis::Commands::Hashes
|
|
488
|
+
# Delete one or more hash fields.
|
|
489
|
+
#
|
|
490
|
+
# @param [String] key
|
|
491
|
+
# @param [String, Array<String>] field
|
|
492
|
+
# @return [Integer] the number of fields that were removed from the hash
|
|
493
|
+
#
|
|
494
|
+
# pkg:gem/redis#lib/redis/commands/hashes.rb:156
|
|
495
|
+
def hdel(key, *fields); end
|
|
496
|
+
|
|
497
|
+
# Determine if a hash field exists.
|
|
498
|
+
#
|
|
499
|
+
# @param [String] key
|
|
500
|
+
# @param [String] field
|
|
501
|
+
# @return [Boolean] whether or not the field exists in the hash
|
|
502
|
+
#
|
|
503
|
+
# pkg:gem/redis#lib/redis/commands/hashes.rb:166
|
|
504
|
+
def hexists(key, field); end
|
|
505
|
+
|
|
506
|
+
# Get the value of a hash field.
|
|
507
|
+
#
|
|
508
|
+
# @param [String] key
|
|
509
|
+
# @param [String] field
|
|
510
|
+
# @return [String]
|
|
511
|
+
#
|
|
512
|
+
# pkg:gem/redis#lib/redis/commands/hashes.rb:74
|
|
513
|
+
def hget(key, field); end
|
|
514
|
+
|
|
515
|
+
# Get all the fields and values in a hash.
|
|
516
|
+
#
|
|
517
|
+
# @param [String] key
|
|
518
|
+
# @return [Hash<String, String>]
|
|
519
|
+
#
|
|
520
|
+
# pkg:gem/redis#lib/redis/commands/hashes.rb:210
|
|
521
|
+
def hgetall(key); end
|
|
522
|
+
|
|
523
|
+
# Increment the integer value of a hash field by the given integer number.
|
|
524
|
+
#
|
|
525
|
+
# @param [String] key
|
|
526
|
+
# @param [String] field
|
|
527
|
+
# @param [Integer] increment
|
|
528
|
+
# @return [Integer] value of the field after incrementing it
|
|
529
|
+
#
|
|
530
|
+
# pkg:gem/redis#lib/redis/commands/hashes.rb:176
|
|
531
|
+
def hincrby(key, field, increment); end
|
|
532
|
+
|
|
533
|
+
# Increment the numeric value of a hash field by the given float number.
|
|
534
|
+
#
|
|
535
|
+
# @param [String] key
|
|
536
|
+
# @param [String] field
|
|
537
|
+
# @param [Float] increment
|
|
538
|
+
# @return [Float] value of the field after incrementing it
|
|
539
|
+
#
|
|
540
|
+
# pkg:gem/redis#lib/redis/commands/hashes.rb:186
|
|
541
|
+
def hincrbyfloat(key, field, increment); end
|
|
542
|
+
|
|
543
|
+
# Get all the fields in a hash.
|
|
544
|
+
#
|
|
545
|
+
# @param [String] key
|
|
546
|
+
# @return [Array<String>]
|
|
547
|
+
#
|
|
548
|
+
# pkg:gem/redis#lib/redis/commands/hashes.rb:194
|
|
549
|
+
def hkeys(key); end
|
|
550
|
+
|
|
551
|
+
# Get the number of fields in a hash.
|
|
552
|
+
#
|
|
553
|
+
# @param [String] key
|
|
554
|
+
# @return [Integer] number of fields in the hash
|
|
555
|
+
#
|
|
556
|
+
# pkg:gem/redis#lib/redis/commands/hashes.rb:10
|
|
557
|
+
def hlen(key); end
|
|
558
|
+
|
|
559
|
+
# Get the values of all the given hash fields.
|
|
560
|
+
#
|
|
561
|
+
# @example
|
|
562
|
+
# redis.hmget("hash", "f1", "f2")
|
|
563
|
+
# # => ["v1", "v2"]
|
|
564
|
+
#
|
|
565
|
+
# @param [String] key
|
|
566
|
+
# @param [Array<String>] fields array of fields
|
|
567
|
+
# @return [Array<String>] an array of values for the specified fields
|
|
568
|
+
#
|
|
569
|
+
# @see #mapped_hmget
|
|
570
|
+
#
|
|
571
|
+
# pkg:gem/redis#lib/redis/commands/hashes.rb:89
|
|
572
|
+
def hmget(key, *fields, &blk); end
|
|
573
|
+
|
|
574
|
+
# Set one or more hash values.
|
|
575
|
+
#
|
|
576
|
+
# @example
|
|
577
|
+
# redis.hmset("hash", "f1", "v1", "f2", "v2")
|
|
578
|
+
# # => "OK"
|
|
579
|
+
#
|
|
580
|
+
# @param [String] key
|
|
581
|
+
# @param [Array<String>] attrs array of fields and values
|
|
582
|
+
# @return [String] `"OK"`
|
|
583
|
+
#
|
|
584
|
+
# @see #mapped_hmset
|
|
585
|
+
#
|
|
586
|
+
# pkg:gem/redis#lib/redis/commands/hashes.rb:50
|
|
587
|
+
def hmset(key, *attrs); end
|
|
588
|
+
|
|
589
|
+
# Get one or more random fields from a hash.
|
|
590
|
+
#
|
|
591
|
+
# @example Get one random field
|
|
592
|
+
# redis.hrandfield("hash")
|
|
593
|
+
# # => "f1"
|
|
594
|
+
# @example Get multiple random fields
|
|
595
|
+
# redis.hrandfield("hash", 2)
|
|
596
|
+
# # => ["f1, "f2"]
|
|
597
|
+
# @example Get multiple random fields with values
|
|
598
|
+
# redis.hrandfield("hash", 2, with_values: true)
|
|
599
|
+
# # => [["f1", "s1"], ["f2", "s2"]]
|
|
600
|
+
#
|
|
601
|
+
# @param [String] key
|
|
602
|
+
# @param [Integer] count
|
|
603
|
+
# @param [Hash] options
|
|
604
|
+
# - `:with_values => true`: include values in output
|
|
605
|
+
#
|
|
606
|
+
# @return [nil, String, Array<String>, Array<[String, Float]>]
|
|
607
|
+
# - when `key` does not exist, `nil`
|
|
608
|
+
# - when `count` is not specified, a field name
|
|
609
|
+
# - when `count` is specified and `:with_values` is not specified, an array of field names
|
|
610
|
+
# - when `:with_values` is specified, an array with `[field, value]` pairs
|
|
611
|
+
#
|
|
612
|
+
# pkg:gem/redis#lib/redis/commands/hashes.rb:138
|
|
613
|
+
def hrandfield(key, count = T.unsafe(nil), withvalues: T.unsafe(nil), with_values: T.unsafe(nil)); end
|
|
614
|
+
|
|
615
|
+
# Scan a hash
|
|
616
|
+
#
|
|
617
|
+
# @example Retrieve the first batch of key/value pairs in a hash
|
|
618
|
+
# redis.hscan("hash", 0)
|
|
619
|
+
#
|
|
620
|
+
# @param [String, Integer] cursor the cursor of the iteration
|
|
621
|
+
# @param [Hash] options
|
|
622
|
+
# - `:match => String`: only return keys matching the pattern
|
|
623
|
+
# - `:count => Integer`: return count keys at most per iteration
|
|
624
|
+
#
|
|
625
|
+
# @return [String, Array<[String, String]>] the next cursor and all found keys
|
|
626
|
+
#
|
|
627
|
+
# See the [Redis Server HSCAN documentation](https://redis.io/docs/latest/commands/hscan/) for further details
|
|
628
|
+
#
|
|
629
|
+
# pkg:gem/redis#lib/redis/commands/hashes.rb:227
|
|
630
|
+
def hscan(key, cursor, **options); end
|
|
631
|
+
|
|
632
|
+
# Scan a hash
|
|
633
|
+
#
|
|
634
|
+
# @example Retrieve all of the key/value pairs in a hash
|
|
635
|
+
# redis.hscan_each("hash").to_a
|
|
636
|
+
# # => [["key70", "70"], ["key80", "80"]]
|
|
637
|
+
#
|
|
638
|
+
# @param [Hash] options
|
|
639
|
+
# - `:match => String`: only return keys matching the pattern
|
|
640
|
+
# - `:count => Integer`: return count keys at most per iteration
|
|
641
|
+
#
|
|
642
|
+
# @return [Enumerator] an enumerator for all found keys
|
|
643
|
+
#
|
|
644
|
+
# See the [Redis Server HSCAN documentation](https://redis.io/docs/latest/commands/hscan/) for further details
|
|
645
|
+
#
|
|
646
|
+
# pkg:gem/redis#lib/redis/commands/hashes.rb:246
|
|
647
|
+
def hscan_each(key, **options, &block); end
|
|
648
|
+
|
|
649
|
+
# Set one or more hash values.
|
|
650
|
+
#
|
|
651
|
+
# @example
|
|
652
|
+
# redis.hset("hash", "f1", "v1", "f2", "v2") # => 2
|
|
653
|
+
# redis.hset("hash", { "f1" => "v1", "f2" => "v2" }) # => 2
|
|
654
|
+
#
|
|
655
|
+
# @param [String] key
|
|
656
|
+
# @param [Array<String> | Hash<String, String>] attrs array or hash of fields and values
|
|
657
|
+
# @return [Integer] The number of fields that were added to the hash
|
|
658
|
+
#
|
|
659
|
+
# pkg:gem/redis#lib/redis/commands/hashes.rb:23
|
|
660
|
+
def hset(key, *attrs); end
|
|
661
|
+
|
|
662
|
+
# Set the value of a hash field, only if the field does not exist.
|
|
663
|
+
#
|
|
664
|
+
# @param [String] key
|
|
665
|
+
# @param [String] field
|
|
666
|
+
# @param [String] value
|
|
667
|
+
# @return [Boolean] whether or not the field was **added** to the hash
|
|
668
|
+
#
|
|
669
|
+
# pkg:gem/redis#lib/redis/commands/hashes.rb:35
|
|
670
|
+
def hsetnx(key, field, value); end
|
|
671
|
+
|
|
672
|
+
# Get all the values in a hash.
|
|
673
|
+
#
|
|
674
|
+
# @param [String] key
|
|
675
|
+
# @return [Array<String>]
|
|
676
|
+
#
|
|
677
|
+
# pkg:gem/redis#lib/redis/commands/hashes.rb:202
|
|
678
|
+
def hvals(key); end
|
|
679
|
+
|
|
680
|
+
# Get the values of all the given hash fields.
|
|
681
|
+
#
|
|
682
|
+
# @example
|
|
683
|
+
# redis.mapped_hmget("hash", "f1", "f2")
|
|
684
|
+
# # => { "f1" => "v1", "f2" => "v2" }
|
|
685
|
+
#
|
|
686
|
+
# @param [String] key
|
|
687
|
+
# @param [Array<String>] fields array of fields
|
|
688
|
+
# @return [Hash] a hash mapping the specified fields to their values
|
|
689
|
+
#
|
|
690
|
+
# @see #hmget
|
|
691
|
+
#
|
|
692
|
+
# pkg:gem/redis#lib/redis/commands/hashes.rb:105
|
|
693
|
+
def mapped_hmget(key, *fields); end
|
|
694
|
+
|
|
695
|
+
# Set one or more hash values.
|
|
696
|
+
#
|
|
697
|
+
# @example
|
|
698
|
+
# redis.mapped_hmset("hash", { "f1" => "v1", "f2" => "v2" })
|
|
699
|
+
# # => "OK"
|
|
700
|
+
#
|
|
701
|
+
# @param [String] key
|
|
702
|
+
# @param [Hash] hash a non-empty hash with fields mapping to values
|
|
703
|
+
# @return [String] `"OK"`
|
|
704
|
+
#
|
|
705
|
+
# @see #hmset
|
|
706
|
+
#
|
|
707
|
+
# pkg:gem/redis#lib/redis/commands/hashes.rb:65
|
|
708
|
+
def mapped_hmset(key, hash); end
|
|
709
|
+
end
|
|
710
|
+
|
|
711
|
+
# pkg:gem/redis#lib/redis/commands.rb:57
|
|
712
|
+
Redis::Commands::Hashify = T.let(T.unsafe(nil), Proc)
|
|
713
|
+
|
|
714
|
+
# pkg:gem/redis#lib/redis/commands.rb:157
|
|
715
|
+
Redis::Commands::HashifyClusterNodeInfo = T.let(T.unsafe(nil), Proc)
|
|
716
|
+
|
|
717
|
+
# pkg:gem/redis#lib/redis/commands.rb:186
|
|
718
|
+
Redis::Commands::HashifyClusterNodes = T.let(T.unsafe(nil), Proc)
|
|
719
|
+
|
|
720
|
+
# pkg:gem/redis#lib/redis/commands.rb:190
|
|
721
|
+
Redis::Commands::HashifyClusterSlaves = T.let(T.unsafe(nil), Proc)
|
|
722
|
+
|
|
723
|
+
# pkg:gem/redis#lib/redis/commands.rb:172
|
|
724
|
+
Redis::Commands::HashifyClusterSlots = T.let(T.unsafe(nil), Proc)
|
|
725
|
+
|
|
726
|
+
# pkg:gem/redis#lib/redis/commands.rb:96
|
|
727
|
+
Redis::Commands::HashifyInfo = T.let(T.unsafe(nil), Proc)
|
|
728
|
+
|
|
729
|
+
# pkg:gem/redis#lib/redis/commands.rb:121
|
|
730
|
+
Redis::Commands::HashifyStreamAutoclaim = T.let(T.unsafe(nil), Proc)
|
|
731
|
+
|
|
732
|
+
# pkg:gem/redis#lib/redis/commands.rb:130
|
|
733
|
+
Redis::Commands::HashifyStreamAutoclaimJustId = T.let(T.unsafe(nil), Proc)
|
|
734
|
+
|
|
735
|
+
# pkg:gem/redis#lib/redis/commands.rb:115
|
|
736
|
+
Redis::Commands::HashifyStreamEntries = T.let(T.unsafe(nil), Proc)
|
|
737
|
+
|
|
738
|
+
# pkg:gem/redis#lib/redis/commands.rb:146
|
|
739
|
+
Redis::Commands::HashifyStreamPendingDetails = T.let(T.unsafe(nil), Proc)
|
|
740
|
+
|
|
741
|
+
# pkg:gem/redis#lib/redis/commands.rb:137
|
|
742
|
+
Redis::Commands::HashifyStreamPendings = T.let(T.unsafe(nil), Proc)
|
|
743
|
+
|
|
744
|
+
# pkg:gem/redis#lib/redis/commands.rb:103
|
|
745
|
+
Redis::Commands::HashifyStreams = T.let(T.unsafe(nil), Proc)
|
|
746
|
+
|
|
747
|
+
# pkg:gem/redis#lib/redis/commands/hyper_log_log.rb:5
|
|
748
|
+
module Redis::Commands::HyperLogLog
|
|
749
|
+
# Add one or more members to a HyperLogLog structure.
|
|
750
|
+
#
|
|
751
|
+
# @param [String] key
|
|
752
|
+
# @param [String, Array<String>] member one member, or array of members
|
|
753
|
+
# @return [Boolean] true if at least 1 HyperLogLog internal register was altered. false otherwise.
|
|
754
|
+
#
|
|
755
|
+
# pkg:gem/redis#lib/redis/commands/hyper_log_log.rb:11
|
|
756
|
+
def pfadd(key, member); end
|
|
757
|
+
|
|
758
|
+
# Get the approximate cardinality of members added to HyperLogLog structure.
|
|
759
|
+
#
|
|
760
|
+
# If called with multiple keys, returns the approximate cardinality of the
|
|
761
|
+
# union of the HyperLogLogs contained in the keys.
|
|
762
|
+
#
|
|
763
|
+
# @param [String, Array<String>] keys
|
|
764
|
+
# @return [Integer]
|
|
765
|
+
#
|
|
766
|
+
# pkg:gem/redis#lib/redis/commands/hyper_log_log.rb:22
|
|
767
|
+
def pfcount(*keys); end
|
|
768
|
+
|
|
769
|
+
# Merge multiple HyperLogLog values into an unique value that will approximate the cardinality of the union of
|
|
770
|
+
# the observed Sets of the source HyperLogLog structures.
|
|
771
|
+
#
|
|
772
|
+
# @param [String] dest_key destination key
|
|
773
|
+
# @param [String, Array<String>] source_key source key, or array of keys
|
|
774
|
+
# @return [Boolean]
|
|
775
|
+
#
|
|
776
|
+
# pkg:gem/redis#lib/redis/commands/hyper_log_log.rb:32
|
|
777
|
+
def pfmerge(dest_key, *source_key); end
|
|
778
|
+
end
|
|
779
|
+
|
|
780
|
+
# pkg:gem/redis#lib/redis/commands/keys.rb:5
|
|
781
|
+
module Redis::Commands::Keys
|
|
782
|
+
# Copy a value from one key to another.
|
|
783
|
+
#
|
|
784
|
+
# @example Copy a value to another key
|
|
785
|
+
# redis.set "foo", "value"
|
|
786
|
+
# # => "OK"
|
|
787
|
+
# redis.copy "foo", "bar"
|
|
788
|
+
# # => true
|
|
789
|
+
# redis.get "bar"
|
|
790
|
+
# # => "value"
|
|
791
|
+
#
|
|
792
|
+
# @example Copy a value to a key in another database
|
|
793
|
+
# redis.set "foo", "value"
|
|
794
|
+
# # => "OK"
|
|
795
|
+
# redis.copy "foo", "bar", db: 2
|
|
796
|
+
# # => true
|
|
797
|
+
# redis.select 2
|
|
798
|
+
# # => "OK"
|
|
799
|
+
# redis.get "bar"
|
|
800
|
+
# # => "value"
|
|
801
|
+
#
|
|
802
|
+
# @param [String] source
|
|
803
|
+
# @param [String] destination
|
|
804
|
+
# @param [Integer] db
|
|
805
|
+
# @param [Boolean] replace removes the `destination` key before copying value to it
|
|
806
|
+
# @return [Boolean] whether the key was copied or not
|
|
807
|
+
#
|
|
808
|
+
# pkg:gem/redis#lib/redis/commands/keys.rb:349
|
|
809
|
+
def copy(source, destination, db: T.unsafe(nil), replace: T.unsafe(nil)); end
|
|
810
|
+
|
|
811
|
+
# Delete one or more keys.
|
|
812
|
+
#
|
|
813
|
+
# @param [String, Array<String>] keys
|
|
814
|
+
# @return [Integer] number of keys that were deleted
|
|
815
|
+
#
|
|
816
|
+
# pkg:gem/redis#lib/redis/commands/keys.rb:252
|
|
817
|
+
def del(*keys); end
|
|
818
|
+
|
|
819
|
+
# Return a serialized version of the value stored at a key.
|
|
820
|
+
#
|
|
821
|
+
# @param [String] key
|
|
822
|
+
# @return [String] serialized_value
|
|
823
|
+
#
|
|
824
|
+
# pkg:gem/redis#lib/redis/commands/keys.rb:203
|
|
825
|
+
def dump(key); end
|
|
826
|
+
|
|
827
|
+
# Determine how many of the keys exists.
|
|
828
|
+
#
|
|
829
|
+
# @param [String, Array<String>] keys
|
|
830
|
+
# @return [Integer]
|
|
831
|
+
#
|
|
832
|
+
# pkg:gem/redis#lib/redis/commands/keys.rb:271
|
|
833
|
+
def exists(*keys); end
|
|
834
|
+
|
|
835
|
+
# Determine if any of the keys exists.
|
|
836
|
+
#
|
|
837
|
+
# @param [String, Array<String>] keys
|
|
838
|
+
# @return [Boolean]
|
|
839
|
+
#
|
|
840
|
+
# pkg:gem/redis#lib/redis/commands/keys.rb:279
|
|
841
|
+
def exists?(*keys); end
|
|
842
|
+
|
|
843
|
+
# Set a key's time to live in seconds.
|
|
844
|
+
#
|
|
845
|
+
# @param [String] key
|
|
846
|
+
# @param [Integer] seconds time to live
|
|
847
|
+
# @param [Hash] options
|
|
848
|
+
# - `:nx => true`: Set expiry only when the key has no expiry.
|
|
849
|
+
# - `:xx => true`: Set expiry only when the key has an existing expiry.
|
|
850
|
+
# - `:gt => true`: Set expiry only when the new expiry is greater than current one.
|
|
851
|
+
# - `:lt => true`: Set expiry only when the new expiry is less than current one.
|
|
852
|
+
# @return [Boolean] whether the timeout was set or not
|
|
853
|
+
#
|
|
854
|
+
# pkg:gem/redis#lib/redis/commands/keys.rb:82
|
|
855
|
+
def expire(key, seconds, nx: T.unsafe(nil), xx: T.unsafe(nil), gt: T.unsafe(nil), lt: T.unsafe(nil)); end
|
|
856
|
+
|
|
857
|
+
# Set the expiration for a key as a UNIX timestamp.
|
|
858
|
+
#
|
|
859
|
+
# @param [String] key
|
|
860
|
+
# @param [Integer] unix_time expiry time specified as a UNIX timestamp
|
|
861
|
+
# @param [Hash] options
|
|
862
|
+
# - `:nx => true`: Set expiry only when the key has no expiry.
|
|
863
|
+
# - `:xx => true`: Set expiry only when the key has an existing expiry.
|
|
864
|
+
# - `:gt => true`: Set expiry only when the new expiry is greater than current one.
|
|
865
|
+
# - `:lt => true`: Set expiry only when the new expiry is less than current one.
|
|
866
|
+
# @return [Boolean] whether the timeout was set or not
|
|
867
|
+
#
|
|
868
|
+
# pkg:gem/redis#lib/redis/commands/keys.rb:102
|
|
869
|
+
def expireat(key, unix_time, nx: T.unsafe(nil), xx: T.unsafe(nil), gt: T.unsafe(nil), lt: T.unsafe(nil)); end
|
|
870
|
+
|
|
871
|
+
# Get a key's expiry time specified as number of seconds from UNIX Epoch
|
|
872
|
+
#
|
|
873
|
+
# @param [String] key
|
|
874
|
+
# @return [Integer] expiry time specified as number of seconds from UNIX Epoch
|
|
875
|
+
#
|
|
876
|
+
# pkg:gem/redis#lib/redis/commands/keys.rb:116
|
|
877
|
+
def expiretime(key); end
|
|
878
|
+
|
|
879
|
+
# Find all keys matching the given pattern.
|
|
880
|
+
#
|
|
881
|
+
# @param [String] pattern
|
|
882
|
+
# @return [Array<String>]
|
|
883
|
+
#
|
|
884
|
+
# See the [Redis Server KEYS documentation](https://redis.io/docs/latest/commands/keys/) for further details
|
|
885
|
+
#
|
|
886
|
+
# pkg:gem/redis#lib/redis/commands/keys.rb:291
|
|
887
|
+
def keys(pattern = T.unsafe(nil)); end
|
|
888
|
+
|
|
889
|
+
# Transfer a key from the connected instance to another instance.
|
|
890
|
+
#
|
|
891
|
+
# @param [String, Array<String>] key
|
|
892
|
+
# @param [Hash] options
|
|
893
|
+
# - `:host => String`: host of instance to migrate to
|
|
894
|
+
# - `:port => Integer`: port of instance to migrate to
|
|
895
|
+
# - `:db => Integer`: database to migrate to (default: same as source)
|
|
896
|
+
# - `:timeout => Integer`: timeout (default: same as connection timeout)
|
|
897
|
+
# - `:copy => Boolean`: Do not remove the key from the local instance.
|
|
898
|
+
# - `:replace => Boolean`: Replace existing key on the remote instance.
|
|
899
|
+
# @return [String] `"OK"`
|
|
900
|
+
#
|
|
901
|
+
# pkg:gem/redis#lib/redis/commands/keys.rb:234
|
|
902
|
+
def migrate(key, options); end
|
|
903
|
+
|
|
904
|
+
# Move a key to another database.
|
|
905
|
+
#
|
|
906
|
+
# @example Move a key to another database
|
|
907
|
+
# redis.set "foo", "bar"
|
|
908
|
+
# # => "OK"
|
|
909
|
+
# redis.move "foo", 2
|
|
910
|
+
# # => true
|
|
911
|
+
# redis.exists "foo"
|
|
912
|
+
# # => false
|
|
913
|
+
# redis.select 2
|
|
914
|
+
# # => "OK"
|
|
915
|
+
# redis.exists "foo"
|
|
916
|
+
# # => true
|
|
917
|
+
# redis.get "foo"
|
|
918
|
+
# # => "bar"
|
|
919
|
+
#
|
|
920
|
+
# @param [String] key
|
|
921
|
+
# @param [Integer] db
|
|
922
|
+
# @return [Boolean] whether the key was moved or not
|
|
923
|
+
#
|
|
924
|
+
# pkg:gem/redis#lib/redis/commands/keys.rb:320
|
|
925
|
+
def move(key, db); end
|
|
926
|
+
|
|
927
|
+
# pkg:gem/redis#lib/redis/commands/keys.rb:357
|
|
928
|
+
def object(*args); end
|
|
929
|
+
|
|
930
|
+
# Remove the expiration from a key.
|
|
931
|
+
#
|
|
932
|
+
# @param [String] key
|
|
933
|
+
# @return [Boolean] whether the timeout was removed or not
|
|
934
|
+
#
|
|
935
|
+
# pkg:gem/redis#lib/redis/commands/keys.rb:68
|
|
936
|
+
def persist(key); end
|
|
937
|
+
|
|
938
|
+
# Set a key's time to live in milliseconds.
|
|
939
|
+
#
|
|
940
|
+
# @param [String] key
|
|
941
|
+
# @param [Integer] milliseconds time to live
|
|
942
|
+
# @param [Hash] options
|
|
943
|
+
# - `:nx => true`: Set expiry only when the key has no expiry.
|
|
944
|
+
# - `:xx => true`: Set expiry only when the key has an existing expiry.
|
|
945
|
+
# - `:gt => true`: Set expiry only when the new expiry is greater than current one.
|
|
946
|
+
# - `:lt => true`: Set expiry only when the new expiry is less than current one.
|
|
947
|
+
# @return [Boolean] whether the timeout was set or not
|
|
948
|
+
#
|
|
949
|
+
# pkg:gem/redis#lib/redis/commands/keys.rb:146
|
|
950
|
+
def pexpire(key, milliseconds, nx: T.unsafe(nil), xx: T.unsafe(nil), gt: T.unsafe(nil), lt: T.unsafe(nil)); end
|
|
951
|
+
|
|
952
|
+
# Set the expiration for a key as number of milliseconds from UNIX Epoch.
|
|
953
|
+
#
|
|
954
|
+
# @param [String] key
|
|
955
|
+
# @param [Integer] ms_unix_time expiry time specified as number of milliseconds from UNIX Epoch.
|
|
956
|
+
# @param [Hash] options
|
|
957
|
+
# - `:nx => true`: Set expiry only when the key has no expiry.
|
|
958
|
+
# - `:xx => true`: Set expiry only when the key has an existing expiry.
|
|
959
|
+
# - `:gt => true`: Set expiry only when the new expiry is greater than current one.
|
|
960
|
+
# - `:lt => true`: Set expiry only when the new expiry is less than current one.
|
|
961
|
+
# @return [Boolean] whether the timeout was set or not
|
|
962
|
+
#
|
|
963
|
+
# pkg:gem/redis#lib/redis/commands/keys.rb:166
|
|
964
|
+
def pexpireat(key, ms_unix_time, nx: T.unsafe(nil), xx: T.unsafe(nil), gt: T.unsafe(nil), lt: T.unsafe(nil)); end
|
|
965
|
+
|
|
966
|
+
# Get a key's expiry time specified as number of milliseconds from UNIX Epoch
|
|
967
|
+
#
|
|
968
|
+
# @param [String] key
|
|
969
|
+
# @return [Integer] expiry time specified as number of milliseconds from UNIX Epoch
|
|
970
|
+
#
|
|
971
|
+
# pkg:gem/redis#lib/redis/commands/keys.rb:180
|
|
972
|
+
def pexpiretime(key); end
|
|
973
|
+
|
|
974
|
+
# Get the time to live (in milliseconds) for a key.
|
|
975
|
+
#
|
|
976
|
+
# @param [String] key
|
|
977
|
+
# @return [Integer] remaining time to live in milliseconds
|
|
978
|
+
# In Redis 2.6 or older the command returns -1 if the key does not exist or if
|
|
979
|
+
# the key exist but has no associated expire.
|
|
980
|
+
#
|
|
981
|
+
# Starting with Redis 2.8 the return value in case of error changed:
|
|
982
|
+
#
|
|
983
|
+
# - The command returns -2 if the key does not exist.
|
|
984
|
+
# - The command returns -1 if the key exists but has no associated expire.
|
|
985
|
+
#
|
|
986
|
+
# pkg:gem/redis#lib/redis/commands/keys.rb:195
|
|
987
|
+
def pttl(key); end
|
|
988
|
+
|
|
989
|
+
# Return a random key from the keyspace.
|
|
990
|
+
#
|
|
991
|
+
# @return [String]
|
|
992
|
+
#
|
|
993
|
+
# pkg:gem/redis#lib/redis/commands/keys.rb:364
|
|
994
|
+
def randomkey; end
|
|
995
|
+
|
|
996
|
+
# Rename a key. If the new key already exists it is overwritten.
|
|
997
|
+
#
|
|
998
|
+
# @param [String] old_name
|
|
999
|
+
# @param [String] new_name
|
|
1000
|
+
# @return [String] `OK`
|
|
1001
|
+
#
|
|
1002
|
+
# pkg:gem/redis#lib/redis/commands/keys.rb:373
|
|
1003
|
+
def rename(old_name, new_name); end
|
|
1004
|
+
|
|
1005
|
+
# Rename a key, only if the new key does not exist.
|
|
1006
|
+
#
|
|
1007
|
+
# @param [String] old_name
|
|
1008
|
+
# @param [String] new_name
|
|
1009
|
+
# @return [Boolean] whether the key was renamed or not
|
|
1010
|
+
#
|
|
1011
|
+
# pkg:gem/redis#lib/redis/commands/keys.rb:382
|
|
1012
|
+
def renamenx(old_name, new_name); end
|
|
1013
|
+
|
|
1014
|
+
# Create a key using the serialized value, previously obtained using DUMP.
|
|
1015
|
+
#
|
|
1016
|
+
# @param [String] key
|
|
1017
|
+
# @param [String] ttl
|
|
1018
|
+
# @param [String] serialized_value
|
|
1019
|
+
# @param [Hash] options
|
|
1020
|
+
# - `:replace => Boolean`: if false, raises an error if key already exists
|
|
1021
|
+
# @raise [Redis::CommandError]
|
|
1022
|
+
# @return [String] `"OK"`
|
|
1023
|
+
#
|
|
1024
|
+
# pkg:gem/redis#lib/redis/commands/keys.rb:216
|
|
1025
|
+
def restore(key, ttl, serialized_value, replace: T.unsafe(nil)); end
|
|
1026
|
+
|
|
1027
|
+
# Scan the keyspace
|
|
1028
|
+
#
|
|
1029
|
+
# @example Retrieve the first batch of keys
|
|
1030
|
+
# redis.scan(0)
|
|
1031
|
+
# # => ["4", ["key:21", "key:47", "key:42"]]
|
|
1032
|
+
# @example Retrieve a batch of keys matching a pattern
|
|
1033
|
+
# redis.scan(4, :match => "key:1?")
|
|
1034
|
+
# # => ["92", ["key:13", "key:18"]]
|
|
1035
|
+
# @example Retrieve a batch of keys of a certain type
|
|
1036
|
+
# redis.scan(92, :type => "zset")
|
|
1037
|
+
# # => ["173", ["sortedset:14", "sortedset:78"]]
|
|
1038
|
+
#
|
|
1039
|
+
# @param [String, Integer] cursor the cursor of the iteration
|
|
1040
|
+
# @param [Hash] options
|
|
1041
|
+
# - `:match => String`: only return keys matching the pattern
|
|
1042
|
+
# - `:count => Integer`: return count keys at most per iteration
|
|
1043
|
+
# - `:type => String`: return keys only of the given type
|
|
1044
|
+
#
|
|
1045
|
+
# @return [String, Array<String>] the next cursor and all found keys
|
|
1046
|
+
#
|
|
1047
|
+
# See the [Redis Server SCAN documentation](https://redis.io/docs/latest/commands/scan/) for further details
|
|
1048
|
+
#
|
|
1049
|
+
# pkg:gem/redis#lib/redis/commands/keys.rb:27
|
|
1050
|
+
def scan(cursor, **options); end
|
|
1051
|
+
|
|
1052
|
+
# Scan the keyspace
|
|
1053
|
+
#
|
|
1054
|
+
# @example Retrieve all of the keys (with possible duplicates)
|
|
1055
|
+
# redis.scan_each.to_a
|
|
1056
|
+
# # => ["key:21", "key:47", "key:42"]
|
|
1057
|
+
# @example Execute block for each key matching a pattern
|
|
1058
|
+
# redis.scan_each(:match => "key:1?") {|key| puts key}
|
|
1059
|
+
# # => key:13
|
|
1060
|
+
# # => key:18
|
|
1061
|
+
# @example Execute block for each key of a type
|
|
1062
|
+
# redis.scan_each(:type => "hash") {|key| puts redis.type(key)}
|
|
1063
|
+
# # => "hash"
|
|
1064
|
+
# # => "hash"
|
|
1065
|
+
#
|
|
1066
|
+
# @param [Hash] options
|
|
1067
|
+
# - `:match => String`: only return keys matching the pattern
|
|
1068
|
+
# - `:count => Integer`: return count keys at most per iteration
|
|
1069
|
+
# - `:type => String`: return keys only of the given type
|
|
1070
|
+
#
|
|
1071
|
+
# @return [Enumerator] an enumerator for all found keys
|
|
1072
|
+
#
|
|
1073
|
+
# See the [Redis Server SCAN documentation](https://redis.io/docs/latest/commands/scan/) for further details
|
|
1074
|
+
#
|
|
1075
|
+
# pkg:gem/redis#lib/redis/commands/keys.rb:53
|
|
1076
|
+
def scan_each(**options, &block); end
|
|
1077
|
+
|
|
1078
|
+
# Sort the elements in a list, set or sorted set.
|
|
1079
|
+
#
|
|
1080
|
+
# @example Retrieve the first 2 elements from an alphabetically sorted "list"
|
|
1081
|
+
# redis.sort("list", :order => "alpha", :limit => [0, 2])
|
|
1082
|
+
# # => ["a", "b"]
|
|
1083
|
+
# @example Store an alphabetically descending list in "target"
|
|
1084
|
+
# redis.sort("list", :order => "desc alpha", :store => "target")
|
|
1085
|
+
# # => 26
|
|
1086
|
+
#
|
|
1087
|
+
# @param [String] key
|
|
1088
|
+
# @param [Hash] options
|
|
1089
|
+
# - `:by => String`: use external key to sort elements by
|
|
1090
|
+
# - `:limit => [offset, count]`: skip `offset` elements, return a maximum
|
|
1091
|
+
# of `count` elements
|
|
1092
|
+
# - `:get => [String, Array<String>]`: single key or array of keys to
|
|
1093
|
+
# retrieve per element in the result
|
|
1094
|
+
# - `:order => String`: combination of `ASC`, `DESC` and optionally `ALPHA`
|
|
1095
|
+
# - `:store => String`: key to store the result at
|
|
1096
|
+
#
|
|
1097
|
+
# @return [Array<String>, Array<Array<String>>, Integer]
|
|
1098
|
+
# - when `:get` is not specified, or holds a single element, an array of elements
|
|
1099
|
+
# - when `:get` is specified, and holds more than one element, an array of
|
|
1100
|
+
# elements where every element is an array with the result for every
|
|
1101
|
+
# element specified in `:get`
|
|
1102
|
+
# - when `:store` is specified, the number of elements in the stored result
|
|
1103
|
+
#
|
|
1104
|
+
# pkg:gem/redis#lib/redis/commands/keys.rb:411
|
|
1105
|
+
def sort(key, by: T.unsafe(nil), limit: T.unsafe(nil), get: T.unsafe(nil), order: T.unsafe(nil), store: T.unsafe(nil)); end
|
|
1106
|
+
|
|
1107
|
+
# Get the time to live (in seconds) for a key.
|
|
1108
|
+
#
|
|
1109
|
+
# @param [String] key
|
|
1110
|
+
# @return [Integer] remaining time to live in seconds.
|
|
1111
|
+
#
|
|
1112
|
+
# In Redis 2.6 or older the command returns -1 if the key does not exist or if
|
|
1113
|
+
# the key exist but has no associated expire.
|
|
1114
|
+
#
|
|
1115
|
+
# Starting with Redis 2.8 the return value in case of error changed:
|
|
1116
|
+
#
|
|
1117
|
+
# - The command returns -2 if the key does not exist.
|
|
1118
|
+
# - The command returns -1 if the key exists but has no associated expire.
|
|
1119
|
+
#
|
|
1120
|
+
# pkg:gem/redis#lib/redis/commands/keys.rb:132
|
|
1121
|
+
def ttl(key); end
|
|
1122
|
+
|
|
1123
|
+
# Determine the type stored at key.
|
|
1124
|
+
#
|
|
1125
|
+
# @param [String] key
|
|
1126
|
+
# @return [String] `string`, `list`, `set`, `zset`, `hash` or `none`
|
|
1127
|
+
#
|
|
1128
|
+
# pkg:gem/redis#lib/redis/commands/keys.rb:441
|
|
1129
|
+
def type(key); end
|
|
1130
|
+
|
|
1131
|
+
# Unlink one or more keys.
|
|
1132
|
+
#
|
|
1133
|
+
# @param [String, Array<String>] keys
|
|
1134
|
+
# @return [Integer] number of keys that were unlinked
|
|
1135
|
+
#
|
|
1136
|
+
# pkg:gem/redis#lib/redis/commands/keys.rb:263
|
|
1137
|
+
def unlink(*keys); end
|
|
1138
|
+
|
|
1139
|
+
private
|
|
1140
|
+
|
|
1141
|
+
# pkg:gem/redis#lib/redis/commands/keys.rb:447
|
|
1142
|
+
def _scan(command, cursor, args, match: T.unsafe(nil), count: T.unsafe(nil), type: T.unsafe(nil), &block); end
|
|
1143
|
+
end
|
|
1144
|
+
|
|
1145
|
+
# pkg:gem/redis#lib/redis/commands/lists.rb:5
|
|
1146
|
+
module Redis::Commands::Lists
|
|
1147
|
+
# Remove the first/last element in a list and append/prepend it
|
|
1148
|
+
# to another list and return it, or block until one is available.
|
|
1149
|
+
#
|
|
1150
|
+
# @example With timeout
|
|
1151
|
+
# element = redis.blmove("foo", "bar", "LEFT", "RIGHT", timeout: 5)
|
|
1152
|
+
# # => nil on timeout
|
|
1153
|
+
# # => "element" on success
|
|
1154
|
+
# @example Without timeout
|
|
1155
|
+
# element = redis.blmove("foo", "bar", "LEFT", "RIGHT")
|
|
1156
|
+
# # => "element"
|
|
1157
|
+
#
|
|
1158
|
+
# @param [String] source source key
|
|
1159
|
+
# @param [String] destination destination key
|
|
1160
|
+
# @param [String, Symbol] where_source from where to remove the element from the source list
|
|
1161
|
+
# e.g. 'LEFT' - from head, 'RIGHT' - from tail
|
|
1162
|
+
# @param [String, Symbol] where_destination where to push the element to the source list
|
|
1163
|
+
# e.g. 'LEFT' - to head, 'RIGHT' - to tail
|
|
1164
|
+
# @param [Hash] options
|
|
1165
|
+
# - `:timeout => [Float, Integer]`: timeout in seconds, defaults to no timeout
|
|
1166
|
+
#
|
|
1167
|
+
# @return [nil, String] the element, or nil when the source key does not exist or the timeout expired
|
|
1168
|
+
#
|
|
1169
|
+
# pkg:gem/redis#lib/redis/commands/lists.rb:55
|
|
1170
|
+
def blmove(source, destination, where_source, where_destination, timeout: T.unsafe(nil)); end
|
|
1171
|
+
|
|
1172
|
+
# Pops one or more elements from the first non-empty list key from the list
|
|
1173
|
+
# of provided key names. If lists are empty, blocks until timeout has passed.
|
|
1174
|
+
#
|
|
1175
|
+
# @example Popping a element
|
|
1176
|
+
# redis.blmpop(1.0, 'list')
|
|
1177
|
+
# #=> ['list', ['a']]
|
|
1178
|
+
# @example With count option
|
|
1179
|
+
# redis.blmpop(1.0, 'list', count: 2)
|
|
1180
|
+
# #=> ['list', ['a', 'b']]
|
|
1181
|
+
#
|
|
1182
|
+
# @params timeout [Float] a float value specifying the maximum number of seconds to block) elapses.
|
|
1183
|
+
# A timeout of zero can be used to block indefinitely.
|
|
1184
|
+
# @params key [String, Array<String>] one or more keys with lists
|
|
1185
|
+
# @params modifier [String]
|
|
1186
|
+
# - when `"LEFT"` - the elements popped are those from the left of the list
|
|
1187
|
+
# - when `"RIGHT"` - the elements popped are those from the right of the list
|
|
1188
|
+
# @params count [Integer] a number of elements to pop
|
|
1189
|
+
#
|
|
1190
|
+
# @return [Array<String, Array<String, Float>>] list of popped elements or nil
|
|
1191
|
+
#
|
|
1192
|
+
# pkg:gem/redis#lib/redis/commands/lists.rb:205
|
|
1193
|
+
def blmpop(timeout, *keys, modifier: T.unsafe(nil), count: T.unsafe(nil)); end
|
|
1194
|
+
|
|
1195
|
+
# Remove and get the first element in a list, or block until one is available.
|
|
1196
|
+
#
|
|
1197
|
+
# @example With timeout
|
|
1198
|
+
# list, element = redis.blpop("list", :timeout => 5)
|
|
1199
|
+
# # => nil on timeout
|
|
1200
|
+
# # => ["list", "element"] on success
|
|
1201
|
+
# @example Without timeout
|
|
1202
|
+
# list, element = redis.blpop("list")
|
|
1203
|
+
# # => ["list", "element"]
|
|
1204
|
+
# @example Blocking pop on multiple lists
|
|
1205
|
+
# list, element = redis.blpop(["list", "another_list"])
|
|
1206
|
+
# # => ["list", "element"]
|
|
1207
|
+
#
|
|
1208
|
+
# @param [String, Array<String>] keys one or more keys to perform the
|
|
1209
|
+
# blocking pop on
|
|
1210
|
+
# @param [Hash] options
|
|
1211
|
+
# - `:timeout => [Float, Integer]`: timeout in seconds, defaults to no timeout
|
|
1212
|
+
#
|
|
1213
|
+
# @return [nil, [String, String]]
|
|
1214
|
+
# - `nil` when the operation timed out
|
|
1215
|
+
# - tuple of the list that was popped from and element was popped otherwise
|
|
1216
|
+
#
|
|
1217
|
+
# pkg:gem/redis#lib/redis/commands/lists.rb:150
|
|
1218
|
+
def blpop(*args); end
|
|
1219
|
+
|
|
1220
|
+
# Remove and get the last element in a list, or block until one is available.
|
|
1221
|
+
#
|
|
1222
|
+
# @param [String, Array<String>] keys one or more keys to perform the
|
|
1223
|
+
# blocking pop on
|
|
1224
|
+
# @param [Hash] options
|
|
1225
|
+
# - `:timeout => [Float, Integer]`: timeout in seconds, defaults to no timeout
|
|
1226
|
+
#
|
|
1227
|
+
# @return [nil, [String, String]]
|
|
1228
|
+
# - `nil` when the operation timed out
|
|
1229
|
+
# - tuple of the list that was popped from and element was popped otherwise
|
|
1230
|
+
#
|
|
1231
|
+
# @see #blpop
|
|
1232
|
+
#
|
|
1233
|
+
# pkg:gem/redis#lib/redis/commands/lists.rb:166
|
|
1234
|
+
def brpop(*args); end
|
|
1235
|
+
|
|
1236
|
+
# Pop a value from a list, push it to another list and return it; or block
|
|
1237
|
+
# until one is available.
|
|
1238
|
+
#
|
|
1239
|
+
# @param [String] source source key
|
|
1240
|
+
# @param [String] destination destination key
|
|
1241
|
+
# @param [Hash] options
|
|
1242
|
+
# - `:timeout => [Float, Integer]`: timeout in seconds, defaults to no timeout
|
|
1243
|
+
#
|
|
1244
|
+
# @return [nil, String]
|
|
1245
|
+
# - `nil` when the operation timed out
|
|
1246
|
+
# - the element was popped and pushed otherwise
|
|
1247
|
+
#
|
|
1248
|
+
# pkg:gem/redis#lib/redis/commands/lists.rb:181
|
|
1249
|
+
def brpoplpush(source, destination, timeout: T.unsafe(nil)); end
|
|
1250
|
+
|
|
1251
|
+
# Get an element from a list by its index.
|
|
1252
|
+
#
|
|
1253
|
+
# @param [String] key
|
|
1254
|
+
# @param [Integer] index
|
|
1255
|
+
# @return [String]
|
|
1256
|
+
#
|
|
1257
|
+
# pkg:gem/redis#lib/redis/commands/lists.rb:245
|
|
1258
|
+
def lindex(key, index); end
|
|
1259
|
+
|
|
1260
|
+
# Insert an element before or after another element in a list.
|
|
1261
|
+
#
|
|
1262
|
+
# @param [String] key
|
|
1263
|
+
# @param [String, Symbol] where `BEFORE` or `AFTER`
|
|
1264
|
+
# @param [String] pivot reference element
|
|
1265
|
+
# @param [String] value
|
|
1266
|
+
# @return [Integer] length of the list after the insert operation, or `-1`
|
|
1267
|
+
# when the element `pivot` was not found
|
|
1268
|
+
#
|
|
1269
|
+
# pkg:gem/redis#lib/redis/commands/lists.rb:257
|
|
1270
|
+
def linsert(key, where, pivot, value); end
|
|
1271
|
+
|
|
1272
|
+
# Get the length of a list.
|
|
1273
|
+
#
|
|
1274
|
+
# @param [String] key
|
|
1275
|
+
# @return [Integer]
|
|
1276
|
+
#
|
|
1277
|
+
# pkg:gem/redis#lib/redis/commands/lists.rb:10
|
|
1278
|
+
def llen(key); end
|
|
1279
|
+
|
|
1280
|
+
# Remove the first/last element in a list, append/prepend it to another list and return it.
|
|
1281
|
+
#
|
|
1282
|
+
# @param [String] source source key
|
|
1283
|
+
# @param [String] destination destination key
|
|
1284
|
+
# @param [String, Symbol] where_source from where to remove the element from the source list
|
|
1285
|
+
# e.g. 'LEFT' - from head, 'RIGHT' - from tail
|
|
1286
|
+
# @param [String, Symbol] where_destination where to push the element to the source list
|
|
1287
|
+
# e.g. 'LEFT' - to head, 'RIGHT' - to tail
|
|
1288
|
+
#
|
|
1289
|
+
# @return [nil, String] the element, or nil when the source key does not exist
|
|
1290
|
+
#
|
|
1291
|
+
# @note This command comes in place of the now deprecated RPOPLPUSH.
|
|
1292
|
+
# Doing LMOVE RIGHT LEFT is equivalent.
|
|
1293
|
+
#
|
|
1294
|
+
# pkg:gem/redis#lib/redis/commands/lists.rb:27
|
|
1295
|
+
def lmove(source, destination, where_source, where_destination); end
|
|
1296
|
+
|
|
1297
|
+
# Pops one or more elements from the first non-empty list key from the list
|
|
1298
|
+
# of provided key names.
|
|
1299
|
+
#
|
|
1300
|
+
# @example Popping a element
|
|
1301
|
+
# redis.lmpop('list')
|
|
1302
|
+
# #=> ['list', ['a']]
|
|
1303
|
+
# @example With count option
|
|
1304
|
+
# redis.lmpop('list', count: 2)
|
|
1305
|
+
# #=> ['list', ['a', 'b']]
|
|
1306
|
+
#
|
|
1307
|
+
# @params key [String, Array<String>] one or more keys with lists
|
|
1308
|
+
# @params modifier [String]
|
|
1309
|
+
# - when `"LEFT"` - the elements popped are those from the left of the list
|
|
1310
|
+
# - when `"RIGHT"` - the elements popped are those from the right of the list
|
|
1311
|
+
# @params count [Integer] a number of elements to pop
|
|
1312
|
+
#
|
|
1313
|
+
# @return [Array<String, Array<String, Float>>] list of popped elements or nil
|
|
1314
|
+
#
|
|
1315
|
+
# pkg:gem/redis#lib/redis/commands/lists.rb:231
|
|
1316
|
+
def lmpop(*keys, modifier: T.unsafe(nil), count: T.unsafe(nil)); end
|
|
1317
|
+
|
|
1318
|
+
# Remove and get the first elements in a list.
|
|
1319
|
+
#
|
|
1320
|
+
# @param [String] key
|
|
1321
|
+
# @param [Integer] count number of elements to remove
|
|
1322
|
+
# @return [nil, String, Array<String>] the values of the first elements
|
|
1323
|
+
#
|
|
1324
|
+
# pkg:gem/redis#lib/redis/commands/lists.rb:103
|
|
1325
|
+
def lpop(key, count = T.unsafe(nil)); end
|
|
1326
|
+
|
|
1327
|
+
# Prepend one or more values to a list, creating the list if it doesn't exist
|
|
1328
|
+
#
|
|
1329
|
+
# @param [String] key
|
|
1330
|
+
# @param [String, Array<String>] value string value, or array of string values to push
|
|
1331
|
+
# @return [Integer] the length of the list after the push operation
|
|
1332
|
+
#
|
|
1333
|
+
# pkg:gem/redis#lib/redis/commands/lists.rb:67
|
|
1334
|
+
def lpush(key, value); end
|
|
1335
|
+
|
|
1336
|
+
# Prepend a value to a list, only if the list exists.
|
|
1337
|
+
#
|
|
1338
|
+
# @param [String] key
|
|
1339
|
+
# @param [String] value
|
|
1340
|
+
# @return [Integer] the length of the list after the push operation
|
|
1341
|
+
#
|
|
1342
|
+
# pkg:gem/redis#lib/redis/commands/lists.rb:76
|
|
1343
|
+
def lpushx(key, value); end
|
|
1344
|
+
|
|
1345
|
+
# Get a range of elements from a list.
|
|
1346
|
+
#
|
|
1347
|
+
# @param [String] key
|
|
1348
|
+
# @param [Integer] start start index
|
|
1349
|
+
# @param [Integer] stop stop index
|
|
1350
|
+
# @return [Array<String>]
|
|
1351
|
+
#
|
|
1352
|
+
# pkg:gem/redis#lib/redis/commands/lists.rb:267
|
|
1353
|
+
def lrange(key, start, stop); end
|
|
1354
|
+
|
|
1355
|
+
# Remove elements from a list.
|
|
1356
|
+
#
|
|
1357
|
+
# @param [String] key
|
|
1358
|
+
# @param [Integer] count number of elements to remove. Use a positive
|
|
1359
|
+
# value to remove the first `count` occurrences of `value`. A negative
|
|
1360
|
+
# value to remove the last `count` occurrences of `value`. Or zero, to
|
|
1361
|
+
# remove all occurrences of `value` from the list.
|
|
1362
|
+
# @param [String] value
|
|
1363
|
+
# @return [Integer] the number of removed elements
|
|
1364
|
+
#
|
|
1365
|
+
# pkg:gem/redis#lib/redis/commands/lists.rb:280
|
|
1366
|
+
def lrem(key, count, value); end
|
|
1367
|
+
|
|
1368
|
+
# Set the value of an element in a list by its index.
|
|
1369
|
+
#
|
|
1370
|
+
# @param [String] key
|
|
1371
|
+
# @param [Integer] index
|
|
1372
|
+
# @param [String] value
|
|
1373
|
+
# @return [String] `OK`
|
|
1374
|
+
#
|
|
1375
|
+
# pkg:gem/redis#lib/redis/commands/lists.rb:290
|
|
1376
|
+
def lset(key, index, value); end
|
|
1377
|
+
|
|
1378
|
+
# Trim a list to the specified range.
|
|
1379
|
+
#
|
|
1380
|
+
# @param [String] key
|
|
1381
|
+
# @param [Integer] start start index
|
|
1382
|
+
# @param [Integer] stop stop index
|
|
1383
|
+
# @return [String] `OK`
|
|
1384
|
+
#
|
|
1385
|
+
# pkg:gem/redis#lib/redis/commands/lists.rb:300
|
|
1386
|
+
def ltrim(key, start, stop); end
|
|
1387
|
+
|
|
1388
|
+
# Remove and get the last elements in a list.
|
|
1389
|
+
#
|
|
1390
|
+
# @param [String] key
|
|
1391
|
+
# @param [Integer] count number of elements to remove
|
|
1392
|
+
# @return [nil, String, Array<String>] the values of the last elements
|
|
1393
|
+
#
|
|
1394
|
+
# pkg:gem/redis#lib/redis/commands/lists.rb:114
|
|
1395
|
+
def rpop(key, count = T.unsafe(nil)); end
|
|
1396
|
+
|
|
1397
|
+
# Remove the last element in a list, append it to another list and return it.
|
|
1398
|
+
#
|
|
1399
|
+
# @param [String] source source key
|
|
1400
|
+
# @param [String] destination destination key
|
|
1401
|
+
# @return [nil, String] the element, or nil when the source key does not exist
|
|
1402
|
+
#
|
|
1403
|
+
# pkg:gem/redis#lib/redis/commands/lists.rb:125
|
|
1404
|
+
def rpoplpush(source, destination); end
|
|
1405
|
+
|
|
1406
|
+
# Append one or more values to a list, creating the list if it doesn't exist
|
|
1407
|
+
#
|
|
1408
|
+
# @param [String] key
|
|
1409
|
+
# @param [String, Array<String>] value string value, or array of string values to push
|
|
1410
|
+
# @return [Integer] the length of the list after the push operation
|
|
1411
|
+
#
|
|
1412
|
+
# pkg:gem/redis#lib/redis/commands/lists.rb:85
|
|
1413
|
+
def rpush(key, value); end
|
|
1414
|
+
|
|
1415
|
+
# Append a value to a list, only if the list exists.
|
|
1416
|
+
#
|
|
1417
|
+
# @param [String] key
|
|
1418
|
+
# @param [String] value
|
|
1419
|
+
# @return [Integer] the length of the list after the push operation
|
|
1420
|
+
#
|
|
1421
|
+
# pkg:gem/redis#lib/redis/commands/lists.rb:94
|
|
1422
|
+
def rpushx(key, value); end
|
|
1423
|
+
|
|
1424
|
+
private
|
|
1425
|
+
|
|
1426
|
+
# pkg:gem/redis#lib/redis/commands/lists.rb:306
|
|
1427
|
+
def _bpop(cmd, args, &blk); end
|
|
1428
|
+
|
|
1429
|
+
# pkg:gem/redis#lib/redis/commands/lists.rb:323
|
|
1430
|
+
def _normalize_move_wheres(where_source, where_destination); end
|
|
1431
|
+
end
|
|
1432
|
+
|
|
1433
|
+
# pkg:gem/redis#lib/redis/commands.rb:194
|
|
1434
|
+
Redis::Commands::Noop = T.let(T.unsafe(nil), Proc)
|
|
1435
|
+
|
|
1436
|
+
# pkg:gem/redis#lib/redis/commands.rb:65
|
|
1437
|
+
Redis::Commands::Pairify = T.let(T.unsafe(nil), Proc)
|
|
1438
|
+
|
|
1439
|
+
# pkg:gem/redis#lib/redis/commands/pubsub.rb:5
|
|
1440
|
+
module Redis::Commands::Pubsub
|
|
1441
|
+
# Listen for messages published to channels matching the given patterns.
|
|
1442
|
+
# See the [Redis Server PSUBSCRIBE documentation](https://redis.io/docs/latest/commands/psubscribe/)
|
|
1443
|
+
# for further details
|
|
1444
|
+
#
|
|
1445
|
+
# pkg:gem/redis#lib/redis/commands/pubsub.rb:34
|
|
1446
|
+
def psubscribe(*channels, &block); end
|
|
1447
|
+
|
|
1448
|
+
# Listen for messages published to channels matching the given patterns.
|
|
1449
|
+
# Throw a timeout error if there is no messages for a timeout period.
|
|
1450
|
+
# See the [Redis Server PSUBSCRIBE documentation](https://redis.io/docs/latest/commands/psubscribe/)
|
|
1451
|
+
# for further details
|
|
1452
|
+
#
|
|
1453
|
+
# pkg:gem/redis#lib/redis/commands/pubsub.rb:42
|
|
1454
|
+
def psubscribe_with_timeout(timeout, *channels, &block); end
|
|
1455
|
+
|
|
1456
|
+
# Post a message to a channel.
|
|
1457
|
+
#
|
|
1458
|
+
# pkg:gem/redis#lib/redis/commands/pubsub.rb:7
|
|
1459
|
+
def publish(channel, message); end
|
|
1460
|
+
|
|
1461
|
+
# Inspect the state of the Pub/Sub subsystem.
|
|
1462
|
+
# Possible subcommands: channels, numsub, numpat.
|
|
1463
|
+
#
|
|
1464
|
+
# pkg:gem/redis#lib/redis/commands/pubsub.rb:55
|
|
1465
|
+
def pubsub(subcommand, *args); end
|
|
1466
|
+
|
|
1467
|
+
# Stop listening for messages posted to channels matching the given patterns.
|
|
1468
|
+
# See the [Redis Server PUNSUBSCRIBE documentation](https://redis.io/docs/latest/commands/punsubscribe/)
|
|
1469
|
+
# for further details
|
|
1470
|
+
#
|
|
1471
|
+
# pkg:gem/redis#lib/redis/commands/pubsub.rb:49
|
|
1472
|
+
def punsubscribe(*channels); end
|
|
1473
|
+
|
|
1474
|
+
# Post a message to a channel in a shard.
|
|
1475
|
+
#
|
|
1476
|
+
# pkg:gem/redis#lib/redis/commands/pubsub.rb:60
|
|
1477
|
+
def spublish(channel, message); end
|
|
1478
|
+
|
|
1479
|
+
# Listen for messages published to the given channels in a shard.
|
|
1480
|
+
#
|
|
1481
|
+
# pkg:gem/redis#lib/redis/commands/pubsub.rb:65
|
|
1482
|
+
def ssubscribe(*channels, &block); end
|
|
1483
|
+
|
|
1484
|
+
# Listen for messages published to the given channels in a shard.
|
|
1485
|
+
# Throw a timeout error if there is no messages for a timeout period.
|
|
1486
|
+
#
|
|
1487
|
+
# pkg:gem/redis#lib/redis/commands/pubsub.rb:71
|
|
1488
|
+
def ssubscribe_with_timeout(timeout, *channels, &block); end
|
|
1489
|
+
|
|
1490
|
+
# Listen for messages published to the given channels.
|
|
1491
|
+
#
|
|
1492
|
+
# pkg:gem/redis#lib/redis/commands/pubsub.rb:16
|
|
1493
|
+
def subscribe(*channels, &block); end
|
|
1494
|
+
|
|
1495
|
+
# Listen for messages published to the given channels. Throw a timeout error
|
|
1496
|
+
# if there is no messages for a timeout period.
|
|
1497
|
+
#
|
|
1498
|
+
# pkg:gem/redis#lib/redis/commands/pubsub.rb:22
|
|
1499
|
+
def subscribe_with_timeout(timeout, *channels, &block); end
|
|
1500
|
+
|
|
1501
|
+
# pkg:gem/redis#lib/redis/commands/pubsub.rb:11
|
|
1502
|
+
def subscribed?; end
|
|
1503
|
+
|
|
1504
|
+
# Stop listening for messages posted to the given channels in a shard.
|
|
1505
|
+
#
|
|
1506
|
+
# pkg:gem/redis#lib/redis/commands/pubsub.rb:76
|
|
1507
|
+
def sunsubscribe(*channels); end
|
|
1508
|
+
|
|
1509
|
+
# Stop listening for messages posted to the given channels.
|
|
1510
|
+
#
|
|
1511
|
+
# pkg:gem/redis#lib/redis/commands/pubsub.rb:27
|
|
1512
|
+
def unsubscribe(*channels); end
|
|
1513
|
+
end
|
|
1514
|
+
|
|
1515
|
+
# pkg:gem/redis#lib/redis/commands/scripting.rb:5
|
|
1516
|
+
module Redis::Commands::Scripting
|
|
1517
|
+
# Evaluate Lua script.
|
|
1518
|
+
#
|
|
1519
|
+
# @example EVAL without KEYS nor ARGV
|
|
1520
|
+
# redis.eval("return 1")
|
|
1521
|
+
# # => 1
|
|
1522
|
+
# @example EVAL with KEYS and ARGV as array arguments
|
|
1523
|
+
# redis.eval("return { KEYS, ARGV }", ["k1", "k2"], ["a1", "a2"])
|
|
1524
|
+
# # => [["k1", "k2"], ["a1", "a2"]]
|
|
1525
|
+
# @example EVAL with KEYS and ARGV in a hash argument
|
|
1526
|
+
# redis.eval("return { KEYS, ARGV }", :keys => ["k1", "k2"], :argv => ["a1", "a2"])
|
|
1527
|
+
# # => [["k1", "k2"], ["a1", "a2"]]
|
|
1528
|
+
#
|
|
1529
|
+
# @param [Array<String>] keys optional array with keys to pass to the script
|
|
1530
|
+
# @param [Array<String>] argv optional array with arguments to pass to the script
|
|
1531
|
+
# @param [Hash] options
|
|
1532
|
+
# - `:keys => Array<String>`: optional array with keys to pass to the script
|
|
1533
|
+
# - `:argv => Array<String>`: optional array with arguments to pass to the script
|
|
1534
|
+
# @return depends on the script
|
|
1535
|
+
#
|
|
1536
|
+
# @see #script
|
|
1537
|
+
# @see #evalsha
|
|
1538
|
+
#
|
|
1539
|
+
# pkg:gem/redis#lib/redis/commands/scripting.rb:71
|
|
1540
|
+
def eval(*args); end
|
|
1541
|
+
|
|
1542
|
+
# Evaluate Lua script by its SHA.
|
|
1543
|
+
#
|
|
1544
|
+
# @example EVALSHA without KEYS nor ARGV
|
|
1545
|
+
# redis.evalsha(sha)
|
|
1546
|
+
# # => <depends on script>
|
|
1547
|
+
# @example EVALSHA with KEYS and ARGV as array arguments
|
|
1548
|
+
# redis.evalsha(sha, ["k1", "k2"], ["a1", "a2"])
|
|
1549
|
+
# # => <depends on script>
|
|
1550
|
+
# @example EVALSHA with KEYS and ARGV in a hash argument
|
|
1551
|
+
# redis.evalsha(sha, :keys => ["k1", "k2"], :argv => ["a1", "a2"])
|
|
1552
|
+
# # => <depends on script>
|
|
1553
|
+
#
|
|
1554
|
+
# @param [Array<String>] keys optional array with keys to pass to the script
|
|
1555
|
+
# @param [Array<String>] argv optional array with arguments to pass to the script
|
|
1556
|
+
# @param [Hash] options
|
|
1557
|
+
# - `:keys => Array<String>`: optional array with keys to pass to the script
|
|
1558
|
+
# - `:argv => Array<String>`: optional array with arguments to pass to the script
|
|
1559
|
+
# @return depends on the script
|
|
1560
|
+
#
|
|
1561
|
+
# @see #script
|
|
1562
|
+
# @see #eval
|
|
1563
|
+
#
|
|
1564
|
+
# pkg:gem/redis#lib/redis/commands/scripting.rb:96
|
|
1565
|
+
def evalsha(*args); end
|
|
1566
|
+
|
|
1567
|
+
# Control remote script registry.
|
|
1568
|
+
#
|
|
1569
|
+
# @example Load a script
|
|
1570
|
+
# sha = redis.script(:load, "return 1")
|
|
1571
|
+
# # => <sha of this script>
|
|
1572
|
+
# @example Check if a script exists
|
|
1573
|
+
# redis.script(:exists, sha)
|
|
1574
|
+
# # => true
|
|
1575
|
+
# @example Check if multiple scripts exist
|
|
1576
|
+
# redis.script(:exists, [sha, other_sha])
|
|
1577
|
+
# # => [true, false]
|
|
1578
|
+
# @example Flush the script registry
|
|
1579
|
+
# redis.script(:flush)
|
|
1580
|
+
# # => "OK"
|
|
1581
|
+
# @example Kill a running script
|
|
1582
|
+
# redis.script(:kill)
|
|
1583
|
+
# # => "OK"
|
|
1584
|
+
#
|
|
1585
|
+
# @param [String] subcommand e.g. `exists`, `flush`, `load`, `kill`
|
|
1586
|
+
# @param [Array<String>] args depends on subcommand
|
|
1587
|
+
# @return [String, Boolean, Array<Boolean>, ...] depends on subcommand
|
|
1588
|
+
#
|
|
1589
|
+
# @see #eval
|
|
1590
|
+
# @see #evalsha
|
|
1591
|
+
#
|
|
1592
|
+
# pkg:gem/redis#lib/redis/commands/scripting.rb:30
|
|
1593
|
+
def script(subcommand, *args); end
|
|
1594
|
+
|
|
1595
|
+
private
|
|
1596
|
+
|
|
1597
|
+
# pkg:gem/redis#lib/redis/commands/scripting.rb:102
|
|
1598
|
+
def _eval(cmd, args); end
|
|
1599
|
+
end
|
|
1600
|
+
|
|
1601
|
+
# pkg:gem/redis#lib/redis/commands/server.rb:5
|
|
1602
|
+
module Redis::Commands::Server
|
|
1603
|
+
# Asynchronously rewrite the append-only file.
|
|
1604
|
+
#
|
|
1605
|
+
# @return [String] `OK`
|
|
1606
|
+
#
|
|
1607
|
+
# pkg:gem/redis#lib/redis/commands/server.rb:9
|
|
1608
|
+
def bgrewriteaof; end
|
|
1609
|
+
|
|
1610
|
+
# Asynchronously save the dataset to disk.
|
|
1611
|
+
#
|
|
1612
|
+
# @return [String] `OK`
|
|
1613
|
+
#
|
|
1614
|
+
# pkg:gem/redis#lib/redis/commands/server.rb:16
|
|
1615
|
+
def bgsave; end
|
|
1616
|
+
|
|
1617
|
+
# Manage client connections.
|
|
1618
|
+
#
|
|
1619
|
+
# @param [String, Symbol] subcommand e.g. `kill`, `list`, `getname`, `setname`
|
|
1620
|
+
# @return [String, Hash] depends on subcommand
|
|
1621
|
+
#
|
|
1622
|
+
# pkg:gem/redis#lib/redis/commands/server.rb:39
|
|
1623
|
+
def client(subcommand, *args); end
|
|
1624
|
+
|
|
1625
|
+
# Get or set server configuration parameters.
|
|
1626
|
+
#
|
|
1627
|
+
# @param [Symbol] action e.g. `:get`, `:set`, `:resetstat`
|
|
1628
|
+
# @return [String, Hash] string reply, or hash when retrieving more than one
|
|
1629
|
+
# property with `CONFIG GET`
|
|
1630
|
+
#
|
|
1631
|
+
# pkg:gem/redis#lib/redis/commands/server.rb:25
|
|
1632
|
+
def config(action, *args); end
|
|
1633
|
+
|
|
1634
|
+
# Return the number of keys in the selected database.
|
|
1635
|
+
#
|
|
1636
|
+
# @return [Integer]
|
|
1637
|
+
#
|
|
1638
|
+
# pkg:gem/redis#lib/redis/commands/server.rb:55
|
|
1639
|
+
def dbsize; end
|
|
1640
|
+
|
|
1641
|
+
# pkg:gem/redis#lib/redis/commands/server.rb:183
|
|
1642
|
+
def debug(*args); end
|
|
1643
|
+
|
|
1644
|
+
# Remove all keys from all databases.
|
|
1645
|
+
#
|
|
1646
|
+
# @param [Hash] options
|
|
1647
|
+
# - `:async => Boolean`: async flush (default: false)
|
|
1648
|
+
# @return [String] `OK`
|
|
1649
|
+
#
|
|
1650
|
+
# pkg:gem/redis#lib/redis/commands/server.rb:64
|
|
1651
|
+
def flushall(options = T.unsafe(nil)); end
|
|
1652
|
+
|
|
1653
|
+
# Remove all keys from the current database.
|
|
1654
|
+
#
|
|
1655
|
+
# @param [Hash] options
|
|
1656
|
+
# - `:async => Boolean`: async flush (default: false)
|
|
1657
|
+
# @return [String] `OK`
|
|
1658
|
+
#
|
|
1659
|
+
# pkg:gem/redis#lib/redis/commands/server.rb:77
|
|
1660
|
+
def flushdb(options = T.unsafe(nil)); end
|
|
1661
|
+
|
|
1662
|
+
# Get information and statistics about the server.
|
|
1663
|
+
#
|
|
1664
|
+
# @param [String, Symbol] cmd e.g. "commandstats"
|
|
1665
|
+
# @return [Hash<String, String>]
|
|
1666
|
+
#
|
|
1667
|
+
# pkg:gem/redis#lib/redis/commands/server.rb:89
|
|
1668
|
+
def info(cmd = T.unsafe(nil)); end
|
|
1669
|
+
|
|
1670
|
+
# Get the UNIX time stamp of the last successful save to disk.
|
|
1671
|
+
#
|
|
1672
|
+
# @return [Integer]
|
|
1673
|
+
#
|
|
1674
|
+
# pkg:gem/redis#lib/redis/commands/server.rb:110
|
|
1675
|
+
def lastsave; end
|
|
1676
|
+
|
|
1677
|
+
# Listen for all requests received by the server in real time.
|
|
1678
|
+
#
|
|
1679
|
+
# There is no way to interrupt this command.
|
|
1680
|
+
#
|
|
1681
|
+
# @yield a block to be called for every line of output
|
|
1682
|
+
# @yieldparam [String] line timestamp and command that was executed
|
|
1683
|
+
#
|
|
1684
|
+
# pkg:gem/redis#lib/redis/commands/server.rb:120
|
|
1685
|
+
def monitor; end
|
|
1686
|
+
|
|
1687
|
+
# Synchronously save the dataset to disk.
|
|
1688
|
+
#
|
|
1689
|
+
# @return [String]
|
|
1690
|
+
#
|
|
1691
|
+
# pkg:gem/redis#lib/redis/commands/server.rb:133
|
|
1692
|
+
def save; end
|
|
1693
|
+
|
|
1694
|
+
# Synchronously save the dataset to disk and then shut down the server.
|
|
1695
|
+
#
|
|
1696
|
+
# pkg:gem/redis#lib/redis/commands/server.rb:138
|
|
1697
|
+
def shutdown; end
|
|
1698
|
+
|
|
1699
|
+
# Make the server a slave of another instance, or promote it as master.
|
|
1700
|
+
#
|
|
1701
|
+
# pkg:gem/redis#lib/redis/commands/server.rb:150
|
|
1702
|
+
def slaveof(host, port); end
|
|
1703
|
+
|
|
1704
|
+
# Interact with the slowlog (get, len, reset)
|
|
1705
|
+
#
|
|
1706
|
+
# @param [String] subcommand e.g. `get`, `len`, `reset`
|
|
1707
|
+
# @param [Integer] length maximum number of entries to return
|
|
1708
|
+
# @return [Array<String>, Integer, String] depends on subcommand
|
|
1709
|
+
#
|
|
1710
|
+
# pkg:gem/redis#lib/redis/commands/server.rb:159
|
|
1711
|
+
def slowlog(subcommand, length = T.unsafe(nil)); end
|
|
1712
|
+
|
|
1713
|
+
# Internal command used for replication.
|
|
1714
|
+
#
|
|
1715
|
+
# pkg:gem/redis#lib/redis/commands/server.rb:166
|
|
1716
|
+
def sync; end
|
|
1717
|
+
|
|
1718
|
+
# Return the server time.
|
|
1719
|
+
#
|
|
1720
|
+
# @example
|
|
1721
|
+
# r.time # => [ 1333093196, 606806 ]
|
|
1722
|
+
#
|
|
1723
|
+
# @return [Array<Integer>] tuple of seconds since UNIX epoch and
|
|
1724
|
+
# microseconds in the current second
|
|
1725
|
+
#
|
|
1726
|
+
# pkg:gem/redis#lib/redis/commands/server.rb:177
|
|
1727
|
+
def time; end
|
|
1728
|
+
end
|
|
1729
|
+
|
|
1730
|
+
# pkg:gem/redis#lib/redis/commands/sets.rb:5
|
|
1731
|
+
module Redis::Commands::Sets
|
|
1732
|
+
# Add one or more members to a set.
|
|
1733
|
+
#
|
|
1734
|
+
# @param [String] key
|
|
1735
|
+
# @param [String, Array<String>] member one member, or array of members
|
|
1736
|
+
# @return [Integer] The number of members that were successfully added
|
|
1737
|
+
#
|
|
1738
|
+
# pkg:gem/redis#lib/redis/commands/sets.rb:19
|
|
1739
|
+
def sadd(key, *members); end
|
|
1740
|
+
|
|
1741
|
+
# Add one or more members to a set.
|
|
1742
|
+
#
|
|
1743
|
+
# @param [String] key
|
|
1744
|
+
# @param [String, Array<String>] member one member, or array of members
|
|
1745
|
+
# @return [Boolean] Wether at least one member was successfully added.
|
|
1746
|
+
#
|
|
1747
|
+
# pkg:gem/redis#lib/redis/commands/sets.rb:29
|
|
1748
|
+
def sadd?(key, *members); end
|
|
1749
|
+
|
|
1750
|
+
# Get the number of members in a set.
|
|
1751
|
+
#
|
|
1752
|
+
# @param [String] key
|
|
1753
|
+
# @return [Integer]
|
|
1754
|
+
#
|
|
1755
|
+
# pkg:gem/redis#lib/redis/commands/sets.rb:10
|
|
1756
|
+
def scard(key); end
|
|
1757
|
+
|
|
1758
|
+
# Subtract multiple sets.
|
|
1759
|
+
#
|
|
1760
|
+
# @param [String, Array<String>] keys keys pointing to sets to subtract
|
|
1761
|
+
# @return [Array<String>] members in the difference
|
|
1762
|
+
#
|
|
1763
|
+
# pkg:gem/redis#lib/redis/commands/sets.rb:123
|
|
1764
|
+
def sdiff(*keys); end
|
|
1765
|
+
|
|
1766
|
+
# Subtract multiple sets and store the resulting set in a key.
|
|
1767
|
+
#
|
|
1768
|
+
# @param [String] destination destination key
|
|
1769
|
+
# @param [String, Array<String>] keys keys pointing to sets to subtract
|
|
1770
|
+
# @return [Integer] number of elements in the resulting set
|
|
1771
|
+
#
|
|
1772
|
+
# pkg:gem/redis#lib/redis/commands/sets.rb:133
|
|
1773
|
+
def sdiffstore(destination, *keys); end
|
|
1774
|
+
|
|
1775
|
+
# Intersect multiple sets.
|
|
1776
|
+
#
|
|
1777
|
+
# @param [String, Array<String>] keys keys pointing to sets to intersect
|
|
1778
|
+
# @return [Array<String>] members in the intersection
|
|
1779
|
+
#
|
|
1780
|
+
# pkg:gem/redis#lib/redis/commands/sets.rb:142
|
|
1781
|
+
def sinter(*keys); end
|
|
1782
|
+
|
|
1783
|
+
# Intersect multiple sets and store the resulting set in a key.
|
|
1784
|
+
#
|
|
1785
|
+
# @param [String] destination destination key
|
|
1786
|
+
# @param [String, Array<String>] keys keys pointing to sets to intersect
|
|
1787
|
+
# @return [Integer] number of elements in the resulting set
|
|
1788
|
+
#
|
|
1789
|
+
# pkg:gem/redis#lib/redis/commands/sets.rb:152
|
|
1790
|
+
def sinterstore(destination, *keys); end
|
|
1791
|
+
|
|
1792
|
+
# Determine if a given value is a member of a set.
|
|
1793
|
+
#
|
|
1794
|
+
# @param [String] key
|
|
1795
|
+
# @param [String] member
|
|
1796
|
+
# @return [Boolean]
|
|
1797
|
+
#
|
|
1798
|
+
# pkg:gem/redis#lib/redis/commands/sets.rb:95
|
|
1799
|
+
def sismember(key, member); end
|
|
1800
|
+
|
|
1801
|
+
# Get all the members in a set.
|
|
1802
|
+
#
|
|
1803
|
+
# @param [String] key
|
|
1804
|
+
# @return [Array<String>]
|
|
1805
|
+
#
|
|
1806
|
+
# pkg:gem/redis#lib/redis/commands/sets.rb:115
|
|
1807
|
+
def smembers(key); end
|
|
1808
|
+
|
|
1809
|
+
# Determine if multiple values are members of a set.
|
|
1810
|
+
#
|
|
1811
|
+
# @param [String] key
|
|
1812
|
+
# @param [String, Array<String>] members
|
|
1813
|
+
# @return [Array<Boolean>]
|
|
1814
|
+
#
|
|
1815
|
+
# pkg:gem/redis#lib/redis/commands/sets.rb:104
|
|
1816
|
+
def smismember(key, *members); end
|
|
1817
|
+
|
|
1818
|
+
# Move a member from one set to another.
|
|
1819
|
+
#
|
|
1820
|
+
# @param [String] source source key
|
|
1821
|
+
# @param [String] destination destination key
|
|
1822
|
+
# @param [String] member member to move from `source` to `destination`
|
|
1823
|
+
# @return [Boolean]
|
|
1824
|
+
#
|
|
1825
|
+
# pkg:gem/redis#lib/redis/commands/sets.rb:86
|
|
1826
|
+
def smove(source, destination, member); end
|
|
1827
|
+
|
|
1828
|
+
# Remove and return one or more random member from a set.
|
|
1829
|
+
#
|
|
1830
|
+
# @param [String] key
|
|
1831
|
+
# @return [String]
|
|
1832
|
+
# @param [Integer] count
|
|
1833
|
+
#
|
|
1834
|
+
# pkg:gem/redis#lib/redis/commands/sets.rb:59
|
|
1835
|
+
def spop(key, count = T.unsafe(nil)); end
|
|
1836
|
+
|
|
1837
|
+
# Get one or more random members from a set.
|
|
1838
|
+
#
|
|
1839
|
+
# @param [String] key
|
|
1840
|
+
# @param [Integer] count
|
|
1841
|
+
# @return [String]
|
|
1842
|
+
#
|
|
1843
|
+
# pkg:gem/redis#lib/redis/commands/sets.rb:72
|
|
1844
|
+
def srandmember(key, count = T.unsafe(nil)); end
|
|
1845
|
+
|
|
1846
|
+
# Remove one or more members from a set.
|
|
1847
|
+
#
|
|
1848
|
+
# @param [String] key
|
|
1849
|
+
# @param [String, Array<String>] member one member, or array of members
|
|
1850
|
+
# @return [Integer] The number of members that were successfully removed
|
|
1851
|
+
#
|
|
1852
|
+
# pkg:gem/redis#lib/redis/commands/sets.rb:39
|
|
1853
|
+
def srem(key, *members); end
|
|
1854
|
+
|
|
1855
|
+
# Remove one or more members from a set.
|
|
1856
|
+
#
|
|
1857
|
+
# @param [String] key
|
|
1858
|
+
# @param [String, Array<String>] member one member, or array of members
|
|
1859
|
+
# @return [Boolean] Wether at least one member was successfully removed.
|
|
1860
|
+
#
|
|
1861
|
+
# pkg:gem/redis#lib/redis/commands/sets.rb:49
|
|
1862
|
+
def srem?(key, *members); end
|
|
1863
|
+
|
|
1864
|
+
# Scan a set
|
|
1865
|
+
#
|
|
1866
|
+
# @example Retrieve the first batch of keys in a set
|
|
1867
|
+
# redis.sscan("set", 0)
|
|
1868
|
+
#
|
|
1869
|
+
# @param [String, Integer] cursor the cursor of the iteration
|
|
1870
|
+
# @param [Hash] options
|
|
1871
|
+
# - `:match => String`: only return keys matching the pattern
|
|
1872
|
+
# - `:count => Integer`: return count keys at most per iteration
|
|
1873
|
+
#
|
|
1874
|
+
# @return [String, Array<String>] the next cursor and all found members
|
|
1875
|
+
#
|
|
1876
|
+
# See the [Redis Server SSCAN documentation](https://redis.io/docs/latest/commands/sscan/) for further details
|
|
1877
|
+
#
|
|
1878
|
+
# pkg:gem/redis#lib/redis/commands/sets.rb:189
|
|
1879
|
+
def sscan(key, cursor, **options); end
|
|
1880
|
+
|
|
1881
|
+
# Scan a set
|
|
1882
|
+
#
|
|
1883
|
+
# @example Retrieve all of the keys in a set
|
|
1884
|
+
# redis.sscan_each("set").to_a
|
|
1885
|
+
# # => ["key1", "key2", "key3"]
|
|
1886
|
+
#
|
|
1887
|
+
# @param [Hash] options
|
|
1888
|
+
# - `:match => String`: only return keys matching the pattern
|
|
1889
|
+
# - `:count => Integer`: return count keys at most per iteration
|
|
1890
|
+
#
|
|
1891
|
+
# @return [Enumerator] an enumerator for all keys in the set
|
|
1892
|
+
#
|
|
1893
|
+
# See the [Redis Server SSCAN documentation](https://redis.io/docs/latest/commands/sscan/) for further details
|
|
1894
|
+
#
|
|
1895
|
+
# pkg:gem/redis#lib/redis/commands/sets.rb:206
|
|
1896
|
+
def sscan_each(key, **options, &block); end
|
|
1897
|
+
|
|
1898
|
+
# Add multiple sets.
|
|
1899
|
+
#
|
|
1900
|
+
# @param [String, Array<String>] keys keys pointing to sets to unify
|
|
1901
|
+
# @return [Array<String>] members in the union
|
|
1902
|
+
#
|
|
1903
|
+
# pkg:gem/redis#lib/redis/commands/sets.rb:161
|
|
1904
|
+
def sunion(*keys); end
|
|
1905
|
+
|
|
1906
|
+
# Add multiple sets and store the resulting set in a key.
|
|
1907
|
+
#
|
|
1908
|
+
# @param [String] destination destination key
|
|
1909
|
+
# @param [String, Array<String>] keys keys pointing to sets to unify
|
|
1910
|
+
# @return [Integer] number of elements in the resulting set
|
|
1911
|
+
#
|
|
1912
|
+
# pkg:gem/redis#lib/redis/commands/sets.rb:171
|
|
1913
|
+
def sunionstore(destination, *keys); end
|
|
1914
|
+
end
|
|
1915
|
+
|
|
1916
|
+
# pkg:gem/redis#lib/redis/commands/sorted_sets.rb:5
|
|
1917
|
+
module Redis::Commands::SortedSets
|
|
1918
|
+
# Removes and returns up to count members with scores in the sorted set stored at key.
|
|
1919
|
+
#
|
|
1920
|
+
# @example Popping a member
|
|
1921
|
+
# redis.bzmpop('zset')
|
|
1922
|
+
# #=> ['zset', ['a', 1.0]]
|
|
1923
|
+
# @example With count option
|
|
1924
|
+
# redis.bzmpop('zset', count: 2)
|
|
1925
|
+
# #=> ['zset', [['a', 1.0], ['b', 2.0]]
|
|
1926
|
+
#
|
|
1927
|
+
# @params timeout [Float] a float value specifying the maximum number of seconds to block) elapses.
|
|
1928
|
+
# A timeout of zero can be used to block indefinitely.
|
|
1929
|
+
# @params key [String, Array<String>] one or more keys with sorted sets
|
|
1930
|
+
# @params modifier [String]
|
|
1931
|
+
# - when `"MIN"` - the elements popped are those with lowest scores
|
|
1932
|
+
# - when `"MAX"` - the elements popped are those with the highest scores
|
|
1933
|
+
# @params count [Integer] a number of members to pop
|
|
1934
|
+
#
|
|
1935
|
+
# @return [Array<String, Array<String, Float>>] list of popped elements and scores
|
|
1936
|
+
#
|
|
1937
|
+
# pkg:gem/redis#lib/redis/commands/sorted_sets.rb:188
|
|
1938
|
+
def bzmpop(timeout, *keys, modifier: T.unsafe(nil), count: T.unsafe(nil)); end
|
|
1939
|
+
|
|
1940
|
+
# Removes and returns up to count members with the highest scores in the sorted set stored at keys,
|
|
1941
|
+
# or block until one is available.
|
|
1942
|
+
#
|
|
1943
|
+
# @example Popping a member from a sorted set
|
|
1944
|
+
# redis.bzpopmax('zset', 1)
|
|
1945
|
+
# #=> ['zset', 'b', 2.0]
|
|
1946
|
+
# @example Popping a member from multiple sorted sets
|
|
1947
|
+
# redis.bzpopmax('zset1', 'zset2', 1)
|
|
1948
|
+
# #=> ['zset1', 'b', 2.0]
|
|
1949
|
+
#
|
|
1950
|
+
# @params keys [Array<String>] one or multiple keys of the sorted sets
|
|
1951
|
+
# @params timeout [Integer] the maximum number of seconds to block
|
|
1952
|
+
#
|
|
1953
|
+
# @return [Array<String, String, Float>] a touple of key, member and score
|
|
1954
|
+
# @return [nil] when no element could be popped and the timeout expired
|
|
1955
|
+
#
|
|
1956
|
+
# pkg:gem/redis#lib/redis/commands/sorted_sets.rb:251
|
|
1957
|
+
def bzpopmax(*args); end
|
|
1958
|
+
|
|
1959
|
+
# Removes and returns up to count members with the lowest scores in the sorted set stored at keys,
|
|
1960
|
+
# or block until one is available.
|
|
1961
|
+
#
|
|
1962
|
+
# @example Popping a member from a sorted set
|
|
1963
|
+
# redis.bzpopmin('zset', 1)
|
|
1964
|
+
# #=> ['zset', 'a', 1.0]
|
|
1965
|
+
# @example Popping a member from multiple sorted sets
|
|
1966
|
+
# redis.bzpopmin('zset1', 'zset2', 1)
|
|
1967
|
+
# #=> ['zset1', 'a', 1.0]
|
|
1968
|
+
#
|
|
1969
|
+
# @params keys [Array<String>] one or multiple keys of the sorted sets
|
|
1970
|
+
# @params timeout [Integer] the maximum number of seconds to block
|
|
1971
|
+
#
|
|
1972
|
+
# @return [Array<String, String, Float>] a touple of key, member and score
|
|
1973
|
+
# @return [nil] when no element could be popped and the timeout expired
|
|
1974
|
+
#
|
|
1975
|
+
# pkg:gem/redis#lib/redis/commands/sorted_sets.rb:272
|
|
1976
|
+
def bzpopmin(*args); end
|
|
1977
|
+
|
|
1978
|
+
# Add one or more members to a sorted set, or update the score for members
|
|
1979
|
+
# that already exist.
|
|
1980
|
+
#
|
|
1981
|
+
# @example Add a single `[score, member]` pair to a sorted set
|
|
1982
|
+
# redis.zadd("zset", 32.0, "member")
|
|
1983
|
+
# @example Add an array of `[score, member]` pairs to a sorted set
|
|
1984
|
+
# redis.zadd("zset", [[32.0, "a"], [64.0, "b"]])
|
|
1985
|
+
#
|
|
1986
|
+
# @param [String] key
|
|
1987
|
+
# @param [[Float, String], Array<[Float, String]>] args
|
|
1988
|
+
# - a single `[score, member]` pair
|
|
1989
|
+
# - an array of `[score, member]` pairs
|
|
1990
|
+
# @param [Hash] options
|
|
1991
|
+
# - `:xx => true`: Only update elements that already exist (never
|
|
1992
|
+
# add elements)
|
|
1993
|
+
# - `:nx => true`: Don't update already existing elements (always
|
|
1994
|
+
# add new elements)
|
|
1995
|
+
# - `:lt => true`: Only update existing elements if the new score
|
|
1996
|
+
# is less than the current score
|
|
1997
|
+
# - `:gt => true`: Only update existing elements if the new score
|
|
1998
|
+
# is greater than the current score
|
|
1999
|
+
# - `:ch => true`: Modify the return value from the number of new
|
|
2000
|
+
# elements added, to the total number of elements changed (CH is an
|
|
2001
|
+
# abbreviation of changed); changed elements are new elements added
|
|
2002
|
+
# and elements already existing for which the score was updated
|
|
2003
|
+
# - `:incr => true`: When this option is specified ZADD acts like
|
|
2004
|
+
# ZINCRBY; only one score-element pair can be specified in this mode
|
|
2005
|
+
#
|
|
2006
|
+
# @return [Boolean, Integer, Float]
|
|
2007
|
+
# - `Boolean` when a single pair is specified, holding whether or not it was
|
|
2008
|
+
# **added** to the sorted set.
|
|
2009
|
+
# - `Integer` when an array of pairs is specified, holding the number of
|
|
2010
|
+
# pairs that were **added** to the sorted set.
|
|
2011
|
+
# - `Float` when option :incr is specified, holding the score of the member
|
|
2012
|
+
# after incrementing it.
|
|
2013
|
+
#
|
|
2014
|
+
# pkg:gem/redis#lib/redis/commands/sorted_sets.rb:53
|
|
2015
|
+
def zadd(key, *args, nx: T.unsafe(nil), xx: T.unsafe(nil), lt: T.unsafe(nil), gt: T.unsafe(nil), ch: T.unsafe(nil), incr: T.unsafe(nil)); end
|
|
2016
|
+
|
|
2017
|
+
# Get the number of members in a sorted set.
|
|
2018
|
+
#
|
|
2019
|
+
# @example
|
|
2020
|
+
# redis.zcard("zset")
|
|
2021
|
+
# # => 4
|
|
2022
|
+
#
|
|
2023
|
+
# @param [String] key
|
|
2024
|
+
# @return [Integer]
|
|
2025
|
+
#
|
|
2026
|
+
# pkg:gem/redis#lib/redis/commands/sorted_sets.rb:14
|
|
2027
|
+
def zcard(key); end
|
|
2028
|
+
|
|
2029
|
+
# Count the members in a sorted set with scores within the given values.
|
|
2030
|
+
#
|
|
2031
|
+
# @example Count members with score `>= 5` and `< 100`
|
|
2032
|
+
# redis.zcount("zset", "5", "(100")
|
|
2033
|
+
# # => 2
|
|
2034
|
+
# @example Count members with scores `> 5`
|
|
2035
|
+
# redis.zcount("zset", "(5", "+inf")
|
|
2036
|
+
# # => 2
|
|
2037
|
+
#
|
|
2038
|
+
# @param [String] key
|
|
2039
|
+
# @param [String] min
|
|
2040
|
+
# - inclusive minimum score is specified verbatim
|
|
2041
|
+
# - exclusive minimum score is specified by prefixing `(`
|
|
2042
|
+
# @param [String] max
|
|
2043
|
+
# - inclusive maximum score is specified verbatim
|
|
2044
|
+
# - exclusive maximum score is specified by prefixing `(`
|
|
2045
|
+
# @return [Integer] number of members in within the specified range
|
|
2046
|
+
#
|
|
2047
|
+
# pkg:gem/redis#lib/redis/commands/sorted_sets.rb:712
|
|
2048
|
+
def zcount(key, min, max); end
|
|
2049
|
+
|
|
2050
|
+
# Return the difference between the first and all successive input sorted sets
|
|
2051
|
+
#
|
|
2052
|
+
# @example
|
|
2053
|
+
# redis.zadd("zsetA", [[1.0, "v1"], [2.0, "v2"]])
|
|
2054
|
+
# redis.zadd("zsetB", [[3.0, "v2"], [2.0, "v3"]])
|
|
2055
|
+
# redis.zdiff("zsetA", "zsetB")
|
|
2056
|
+
# => ["v1"]
|
|
2057
|
+
# @example With scores
|
|
2058
|
+
# redis.zadd("zsetA", [[1.0, "v1"], [2.0, "v2"]])
|
|
2059
|
+
# redis.zadd("zsetB", [[3.0, "v2"], [2.0, "v3"]])
|
|
2060
|
+
# redis.zdiff("zsetA", "zsetB", :with_scores => true)
|
|
2061
|
+
# => [["v1", 1.0]]
|
|
2062
|
+
#
|
|
2063
|
+
# @param [String, Array<String>] keys one or more keys to compute the difference
|
|
2064
|
+
# @param [Hash] options
|
|
2065
|
+
# - `:with_scores => true`: include scores in output
|
|
2066
|
+
#
|
|
2067
|
+
# @return [Array<String>, Array<[String, Float]>]
|
|
2068
|
+
# - when `:with_scores` is not specified, an array of members
|
|
2069
|
+
# - when `:with_scores` is specified, an array with `[member, score]` pairs
|
|
2070
|
+
#
|
|
2071
|
+
# pkg:gem/redis#lib/redis/commands/sorted_sets.rb:821
|
|
2072
|
+
def zdiff(*keys, with_scores: T.unsafe(nil)); end
|
|
2073
|
+
|
|
2074
|
+
# Compute the difference between the first and all successive input sorted sets
|
|
2075
|
+
# and store the resulting sorted set in a new key
|
|
2076
|
+
#
|
|
2077
|
+
# @example
|
|
2078
|
+
# redis.zadd("zsetA", [[1.0, "v1"], [2.0, "v2"]])
|
|
2079
|
+
# redis.zadd("zsetB", [[3.0, "v2"], [2.0, "v3"]])
|
|
2080
|
+
# redis.zdiffstore("zsetA", "zsetB")
|
|
2081
|
+
# # => 1
|
|
2082
|
+
#
|
|
2083
|
+
# @param [String] destination destination key
|
|
2084
|
+
# @param [Array<String>] keys source keys
|
|
2085
|
+
# @return [Integer] number of elements in the resulting sorted set
|
|
2086
|
+
#
|
|
2087
|
+
# pkg:gem/redis#lib/redis/commands/sorted_sets.rb:837
|
|
2088
|
+
def zdiffstore(*args, **_arg1); end
|
|
2089
|
+
|
|
2090
|
+
# Increment the score of a member in a sorted set.
|
|
2091
|
+
#
|
|
2092
|
+
# @example
|
|
2093
|
+
# redis.zincrby("zset", 32.0, "a")
|
|
2094
|
+
# # => 64.0
|
|
2095
|
+
#
|
|
2096
|
+
# @param [String] key
|
|
2097
|
+
# @param [Float] increment
|
|
2098
|
+
# @param [String] member
|
|
2099
|
+
# @return [Float] score of the member after incrementing it
|
|
2100
|
+
#
|
|
2101
|
+
# pkg:gem/redis#lib/redis/commands/sorted_sets.rb:86
|
|
2102
|
+
def zincrby(key, increment, member); end
|
|
2103
|
+
|
|
2104
|
+
# Return the intersection of multiple sorted sets
|
|
2105
|
+
#
|
|
2106
|
+
# @example Retrieve the intersection of `2*zsetA` and `1*zsetB`
|
|
2107
|
+
# redis.zinter("zsetA", "zsetB", :weights => [2.0, 1.0])
|
|
2108
|
+
# # => ["v1", "v2"]
|
|
2109
|
+
# @example Retrieve the intersection of `2*zsetA` and `1*zsetB`, and their scores
|
|
2110
|
+
# redis.zinter("zsetA", "zsetB", :weights => [2.0, 1.0], :with_scores => true)
|
|
2111
|
+
# # => [["v1", 3.0], ["v2", 6.0]]
|
|
2112
|
+
#
|
|
2113
|
+
# @param [String, Array<String>] keys one or more keys to intersect
|
|
2114
|
+
# @param [Hash] options
|
|
2115
|
+
# - `:weights => [Float, Float, ...]`: weights to associate with source
|
|
2116
|
+
# sorted sets
|
|
2117
|
+
# - `:aggregate => String`: aggregate function to use (sum, min, max, ...)
|
|
2118
|
+
# - `:with_scores => true`: include scores in output
|
|
2119
|
+
#
|
|
2120
|
+
# @return [Array<String>, Array<[String, Float]>]
|
|
2121
|
+
# - when `:with_scores` is not specified, an array of members
|
|
2122
|
+
# - when `:with_scores` is specified, an array with `[member, score]` pairs
|
|
2123
|
+
#
|
|
2124
|
+
# pkg:gem/redis#lib/redis/commands/sorted_sets.rb:735
|
|
2125
|
+
def zinter(*args, **_arg1); end
|
|
2126
|
+
|
|
2127
|
+
# Intersect multiple sorted sets and store the resulting sorted set in a new
|
|
2128
|
+
# key.
|
|
2129
|
+
#
|
|
2130
|
+
# @example Compute the intersection of `2*zsetA` with `1*zsetB`, summing their scores
|
|
2131
|
+
# redis.zinterstore("zsetC", ["zsetA", "zsetB"], :weights => [2.0, 1.0], :aggregate => "sum")
|
|
2132
|
+
# # => 4
|
|
2133
|
+
#
|
|
2134
|
+
# @param [String] destination destination key
|
|
2135
|
+
# @param [Array<String>] keys source keys
|
|
2136
|
+
# @param [Hash] options
|
|
2137
|
+
# - `:weights => [Array<Float>]`: weights to associate with source
|
|
2138
|
+
# sorted sets
|
|
2139
|
+
# - `:aggregate => String`: aggregate function to use (sum, min, max)
|
|
2140
|
+
# @return [Integer] number of elements in the resulting sorted set
|
|
2141
|
+
#
|
|
2142
|
+
# pkg:gem/redis#lib/redis/commands/sorted_sets.rb:754
|
|
2143
|
+
def zinterstore(*args, **_arg1); end
|
|
2144
|
+
|
|
2145
|
+
# Count the members, with the same score in a sorted set, within the given lexicographical range.
|
|
2146
|
+
#
|
|
2147
|
+
# @example Count members matching a
|
|
2148
|
+
# redis.zlexcount("zset", "[a", "[a\xff")
|
|
2149
|
+
# # => 1
|
|
2150
|
+
# @example Count members matching a-z
|
|
2151
|
+
# redis.zlexcount("zset", "[a", "[z\xff")
|
|
2152
|
+
# # => 26
|
|
2153
|
+
#
|
|
2154
|
+
# @param [String] key
|
|
2155
|
+
# @param [String] min
|
|
2156
|
+
# - inclusive minimum is specified by prefixing `(`
|
|
2157
|
+
# - exclusive minimum is specified by prefixing `[`
|
|
2158
|
+
# @param [String] max
|
|
2159
|
+
# - inclusive maximum is specified by prefixing `(`
|
|
2160
|
+
# - exclusive maximum is specified by prefixing `[`
|
|
2161
|
+
#
|
|
2162
|
+
# @return [Integer] number of members within the specified lexicographical range
|
|
2163
|
+
#
|
|
2164
|
+
# pkg:gem/redis#lib/redis/commands/sorted_sets.rb:543
|
|
2165
|
+
def zlexcount(key, min, max); end
|
|
2166
|
+
|
|
2167
|
+
# Removes and returns up to count members with scores in the sorted set stored at key.
|
|
2168
|
+
#
|
|
2169
|
+
# @example Popping a member
|
|
2170
|
+
# redis.zmpop('zset')
|
|
2171
|
+
# #=> ['zset', ['a', 1.0]]
|
|
2172
|
+
# @example With count option
|
|
2173
|
+
# redis.zmpop('zset', count: 2)
|
|
2174
|
+
# #=> ['zset', [['a', 1.0], ['b', 2.0]]
|
|
2175
|
+
#
|
|
2176
|
+
# @params key [String, Array<String>] one or more keys with sorted sets
|
|
2177
|
+
# @params modifier [String]
|
|
2178
|
+
# - when `"MIN"` - the elements popped are those with lowest scores
|
|
2179
|
+
# - when `"MAX"` - the elements popped are those with the highest scores
|
|
2180
|
+
# @params count [Integer] a number of members to pop
|
|
2181
|
+
#
|
|
2182
|
+
# @return [Array<String, Array<String, Float>>] list of popped elements and scores
|
|
2183
|
+
#
|
|
2184
|
+
# pkg:gem/redis#lib/redis/commands/sorted_sets.rb:220
|
|
2185
|
+
def zmpop(*keys, modifier: T.unsafe(nil), count: T.unsafe(nil)); end
|
|
2186
|
+
|
|
2187
|
+
# Get the scores associated with the given members in a sorted set.
|
|
2188
|
+
#
|
|
2189
|
+
# @example Get the scores for members "a" and "b"
|
|
2190
|
+
# redis.zmscore("zset", "a", "b")
|
|
2191
|
+
# # => [32.0, 48.0]
|
|
2192
|
+
#
|
|
2193
|
+
# @param [String] key
|
|
2194
|
+
# @param [String, Array<String>] members
|
|
2195
|
+
# @return [Array<Float>] scores of the members
|
|
2196
|
+
#
|
|
2197
|
+
# pkg:gem/redis#lib/redis/commands/sorted_sets.rb:300
|
|
2198
|
+
def zmscore(key, *members); end
|
|
2199
|
+
|
|
2200
|
+
# Removes and returns up to count members with the highest scores in the sorted set stored at key.
|
|
2201
|
+
#
|
|
2202
|
+
# @example Popping a member
|
|
2203
|
+
# redis.zpopmax('zset')
|
|
2204
|
+
# #=> ['b', 2.0]
|
|
2205
|
+
# @example With count option
|
|
2206
|
+
# redis.zpopmax('zset', 2)
|
|
2207
|
+
# #=> [['b', 2.0], ['a', 1.0]]
|
|
2208
|
+
#
|
|
2209
|
+
# @params key [String] a key of the sorted set
|
|
2210
|
+
# @params count [Integer] a number of members
|
|
2211
|
+
#
|
|
2212
|
+
# @return [Array<String, Float>] element and score pair if count is not specified
|
|
2213
|
+
# @return [Array<Array<String, Float>>] list of popped elements and scores
|
|
2214
|
+
#
|
|
2215
|
+
# pkg:gem/redis#lib/redis/commands/sorted_sets.rb:138
|
|
2216
|
+
def zpopmax(key, count = T.unsafe(nil)); end
|
|
2217
|
+
|
|
2218
|
+
# Removes and returns up to count members with the lowest scores in the sorted set stored at key.
|
|
2219
|
+
#
|
|
2220
|
+
# @example Popping a member
|
|
2221
|
+
# redis.zpopmin('zset')
|
|
2222
|
+
# #=> ['a', 1.0]
|
|
2223
|
+
# @example With count option
|
|
2224
|
+
# redis.zpopmin('zset', 2)
|
|
2225
|
+
# #=> [['a', 1.0], ['b', 2.0]]
|
|
2226
|
+
#
|
|
2227
|
+
# @params key [String] a key of the sorted set
|
|
2228
|
+
# @params count [Integer] a number of members
|
|
2229
|
+
#
|
|
2230
|
+
# @return [Array<String, Float>] element and score pair if count is not specified
|
|
2231
|
+
# @return [Array<Array<String, Float>>] list of popped elements and scores
|
|
2232
|
+
#
|
|
2233
|
+
# pkg:gem/redis#lib/redis/commands/sorted_sets.rb:161
|
|
2234
|
+
def zpopmin(key, count = T.unsafe(nil)); end
|
|
2235
|
+
|
|
2236
|
+
# Get one or more random members from a sorted set.
|
|
2237
|
+
#
|
|
2238
|
+
# @example Get one random member
|
|
2239
|
+
# redis.zrandmember("zset")
|
|
2240
|
+
# # => "a"
|
|
2241
|
+
# @example Get multiple random members
|
|
2242
|
+
# redis.zrandmember("zset", 2)
|
|
2243
|
+
# # => ["a", "b"]
|
|
2244
|
+
# @example Get multiple random members with scores
|
|
2245
|
+
# redis.zrandmember("zset", 2, with_scores: true)
|
|
2246
|
+
# # => [["a", 2.0], ["b", 3.0]]
|
|
2247
|
+
#
|
|
2248
|
+
# @param [String] key
|
|
2249
|
+
# @param [Integer] count
|
|
2250
|
+
# @param [Hash] options
|
|
2251
|
+
# - `:with_scores => true`: include scores in output
|
|
2252
|
+
#
|
|
2253
|
+
# @return [nil, String, Array<String>, Array<[String, Float]>]
|
|
2254
|
+
# - when `key` does not exist or set is empty, `nil`
|
|
2255
|
+
# - when `count` is not specified, a member
|
|
2256
|
+
# - when `count` is specified and `:with_scores` is not specified, an array of members
|
|
2257
|
+
# - when `:with_scores` is specified, an array with `[member, score]` pairs
|
|
2258
|
+
#
|
|
2259
|
+
# pkg:gem/redis#lib/redis/commands/sorted_sets.rb:328
|
|
2260
|
+
def zrandmember(key, count = T.unsafe(nil), withscores: T.unsafe(nil), with_scores: T.unsafe(nil)); end
|
|
2261
|
+
|
|
2262
|
+
# Return a range of members in a sorted set, by index, score or lexicographical ordering.
|
|
2263
|
+
#
|
|
2264
|
+
# @example Retrieve all members from a sorted set, by index
|
|
2265
|
+
# redis.zrange("zset", 0, -1)
|
|
2266
|
+
# # => ["a", "b"]
|
|
2267
|
+
# @example Retrieve all members and their scores from a sorted set
|
|
2268
|
+
# redis.zrange("zset", 0, -1, :with_scores => true)
|
|
2269
|
+
# # => [["a", 32.0], ["b", 64.0]]
|
|
2270
|
+
#
|
|
2271
|
+
# @param [String] key
|
|
2272
|
+
# @param [Integer] start start index
|
|
2273
|
+
# @param [Integer] stop stop index
|
|
2274
|
+
# @param [Hash] options
|
|
2275
|
+
# - `:by_score => false`: return members by score
|
|
2276
|
+
# - `:by_lex => false`: return members by lexicographical ordering
|
|
2277
|
+
# - `:rev => false`: reverse the ordering, from highest to lowest
|
|
2278
|
+
# - `:limit => [offset, count]`: skip `offset` members, return a maximum of
|
|
2279
|
+
# `count` members
|
|
2280
|
+
# - `:with_scores => true`: include scores in output
|
|
2281
|
+
#
|
|
2282
|
+
# @return [Array<String>, Array<[String, Float]>]
|
|
2283
|
+
# - when `:with_scores` is not specified, an array of members
|
|
2284
|
+
# - when `:with_scores` is specified, an array with `[member, score]` pairs
|
|
2285
|
+
#
|
|
2286
|
+
# pkg:gem/redis#lib/redis/commands/sorted_sets.rb:367
|
|
2287
|
+
def zrange(key, start, stop, byscore: T.unsafe(nil), by_score: T.unsafe(nil), bylex: T.unsafe(nil), by_lex: T.unsafe(nil), rev: T.unsafe(nil), limit: T.unsafe(nil), withscores: T.unsafe(nil), with_scores: T.unsafe(nil)); end
|
|
2288
|
+
|
|
2289
|
+
# Return a range of members with the same score in a sorted set, by lexicographical ordering
|
|
2290
|
+
#
|
|
2291
|
+
# @example Retrieve members matching a
|
|
2292
|
+
# redis.zrangebylex("zset", "[a", "[a\xff")
|
|
2293
|
+
# # => ["aaren", "aarika", "abagael", "abby"]
|
|
2294
|
+
# @example Retrieve the first 2 members matching a
|
|
2295
|
+
# redis.zrangebylex("zset", "[a", "[a\xff", :limit => [0, 2])
|
|
2296
|
+
# # => ["aaren", "aarika"]
|
|
2297
|
+
#
|
|
2298
|
+
# @param [String] key
|
|
2299
|
+
# @param [String] min
|
|
2300
|
+
# - inclusive minimum is specified by prefixing `(`
|
|
2301
|
+
# - exclusive minimum is specified by prefixing `[`
|
|
2302
|
+
# @param [String] max
|
|
2303
|
+
# - inclusive maximum is specified by prefixing `(`
|
|
2304
|
+
# - exclusive maximum is specified by prefixing `[`
|
|
2305
|
+
# @param [Hash] options
|
|
2306
|
+
# - `:limit => [offset, count]`: skip `offset` members, return a maximum of
|
|
2307
|
+
# `count` members
|
|
2308
|
+
#
|
|
2309
|
+
# @return [Array<String>, Array<[String, Float]>]
|
|
2310
|
+
#
|
|
2311
|
+
# pkg:gem/redis#lib/redis/commands/sorted_sets.rb:568
|
|
2312
|
+
def zrangebylex(key, min, max, limit: T.unsafe(nil)); end
|
|
2313
|
+
|
|
2314
|
+
# Return a range of members in a sorted set, by score.
|
|
2315
|
+
#
|
|
2316
|
+
# @example Retrieve members with score `>= 5` and `< 100`
|
|
2317
|
+
# redis.zrangebyscore("zset", "5", "(100")
|
|
2318
|
+
# # => ["a", "b"]
|
|
2319
|
+
# @example Retrieve the first 2 members with score `>= 0`
|
|
2320
|
+
# redis.zrangebyscore("zset", "0", "+inf", :limit => [0, 2])
|
|
2321
|
+
# # => ["a", "b"]
|
|
2322
|
+
# @example Retrieve members and their scores with scores `> 5`
|
|
2323
|
+
# redis.zrangebyscore("zset", "(5", "+inf", :with_scores => true)
|
|
2324
|
+
# # => [["a", 32.0], ["b", 64.0]]
|
|
2325
|
+
#
|
|
2326
|
+
# @param [String] key
|
|
2327
|
+
# @param [String] min
|
|
2328
|
+
# - inclusive minimum score is specified verbatim
|
|
2329
|
+
# - exclusive minimum score is specified by prefixing `(`
|
|
2330
|
+
# @param [String] max
|
|
2331
|
+
# - inclusive maximum score is specified verbatim
|
|
2332
|
+
# - exclusive maximum score is specified by prefixing `(`
|
|
2333
|
+
# @param [Hash] options
|
|
2334
|
+
# - `:with_scores => true`: include scores in output
|
|
2335
|
+
# - `:limit => [offset, count]`: skip `offset` members, return a maximum of
|
|
2336
|
+
# `count` members
|
|
2337
|
+
#
|
|
2338
|
+
# @return [Array<String>, Array<[String, Float]>]
|
|
2339
|
+
# - when `:with_scores` is not specified, an array of members
|
|
2340
|
+
# - when `:with_scores` is specified, an array with `[member, score]` pairs
|
|
2341
|
+
#
|
|
2342
|
+
# pkg:gem/redis#lib/redis/commands/sorted_sets.rb:628
|
|
2343
|
+
def zrangebyscore(key, min, max, withscores: T.unsafe(nil), with_scores: T.unsafe(nil), limit: T.unsafe(nil)); end
|
|
2344
|
+
|
|
2345
|
+
# Select a range of members in a sorted set, by index, score or lexicographical ordering
|
|
2346
|
+
# and store the resulting sorted set in a new key.
|
|
2347
|
+
#
|
|
2348
|
+
# @example
|
|
2349
|
+
# redis.zadd("foo", [[1.0, "s1"], [2.0, "s2"], [3.0, "s3"]])
|
|
2350
|
+
# redis.zrangestore("bar", "foo", 0, 1)
|
|
2351
|
+
# # => 2
|
|
2352
|
+
# redis.zrange("bar", 0, -1)
|
|
2353
|
+
# # => ["s1", "s2"]
|
|
2354
|
+
#
|
|
2355
|
+
# @return [Integer] the number of elements in the resulting sorted set
|
|
2356
|
+
# @see #zrange
|
|
2357
|
+
#
|
|
2358
|
+
# pkg:gem/redis#lib/redis/commands/sorted_sets.rb:409
|
|
2359
|
+
def zrangestore(dest_key, src_key, start, stop, byscore: T.unsafe(nil), by_score: T.unsafe(nil), bylex: T.unsafe(nil), by_lex: T.unsafe(nil), rev: T.unsafe(nil), limit: T.unsafe(nil)); end
|
|
2360
|
+
|
|
2361
|
+
# Determine the index of a member in a sorted set.
|
|
2362
|
+
#
|
|
2363
|
+
# @example Retrieve member rank
|
|
2364
|
+
# redis.zrank("zset", "a")
|
|
2365
|
+
# # => 3
|
|
2366
|
+
# @example Retrieve member rank with their score
|
|
2367
|
+
# redis.zrank("zset", "a", :with_score => true)
|
|
2368
|
+
# # => [3, 32.0]
|
|
2369
|
+
#
|
|
2370
|
+
# @param [String] key
|
|
2371
|
+
# @param [String] member
|
|
2372
|
+
#
|
|
2373
|
+
# @return [Integer, [Integer, Float]]
|
|
2374
|
+
# - when `:with_score` is not specified, an Integer
|
|
2375
|
+
# - when `:with_score` is specified, a `[rank, score]` pair
|
|
2376
|
+
#
|
|
2377
|
+
# pkg:gem/redis#lib/redis/commands/sorted_sets.rb:470
|
|
2378
|
+
def zrank(key, member, withscore: T.unsafe(nil), with_score: T.unsafe(nil)); end
|
|
2379
|
+
|
|
2380
|
+
# Remove one or more members from a sorted set.
|
|
2381
|
+
#
|
|
2382
|
+
# @example Remove a single member from a sorted set
|
|
2383
|
+
# redis.zrem("zset", "a")
|
|
2384
|
+
# @example Remove an array of members from a sorted set
|
|
2385
|
+
# redis.zrem("zset", ["a", "b"])
|
|
2386
|
+
#
|
|
2387
|
+
# @param [String] key
|
|
2388
|
+
# @param [String, Array<String>] member
|
|
2389
|
+
# - a single member
|
|
2390
|
+
# - an array of members
|
|
2391
|
+
#
|
|
2392
|
+
# @return [Boolean, Integer]
|
|
2393
|
+
# - `Boolean` when a single member is specified, holding whether or not it
|
|
2394
|
+
# was removed from the sorted set
|
|
2395
|
+
# - `Integer` when an array of pairs is specified, holding the number of
|
|
2396
|
+
# members that were removed to the sorted set
|
|
2397
|
+
#
|
|
2398
|
+
# pkg:gem/redis#lib/redis/commands/sorted_sets.rb:107
|
|
2399
|
+
def zrem(key, member); end
|
|
2400
|
+
|
|
2401
|
+
# Remove all members in a sorted set within the given indexes.
|
|
2402
|
+
#
|
|
2403
|
+
# @example Remove first 5 members
|
|
2404
|
+
# redis.zremrangebyrank("zset", 0, 4)
|
|
2405
|
+
# # => 5
|
|
2406
|
+
# @example Remove last 5 members
|
|
2407
|
+
# redis.zremrangebyrank("zset", -5, -1)
|
|
2408
|
+
# # => 5
|
|
2409
|
+
#
|
|
2410
|
+
# @param [String] key
|
|
2411
|
+
# @param [Integer] start start index
|
|
2412
|
+
# @param [Integer] stop stop index
|
|
2413
|
+
# @return [Integer] number of members that were removed
|
|
2414
|
+
#
|
|
2415
|
+
# pkg:gem/redis#lib/redis/commands/sorted_sets.rb:521
|
|
2416
|
+
def zremrangebyrank(key, start, stop); end
|
|
2417
|
+
|
|
2418
|
+
# Remove all members in a sorted set within the given scores.
|
|
2419
|
+
#
|
|
2420
|
+
# @example Remove members with score `>= 5` and `< 100`
|
|
2421
|
+
# redis.zremrangebyscore("zset", "5", "(100")
|
|
2422
|
+
# # => 2
|
|
2423
|
+
# @example Remove members with scores `> 5`
|
|
2424
|
+
# redis.zremrangebyscore("zset", "(5", "+inf")
|
|
2425
|
+
# # => 2
|
|
2426
|
+
#
|
|
2427
|
+
# @param [String] key
|
|
2428
|
+
# @param [String] min
|
|
2429
|
+
# - inclusive minimum score is specified verbatim
|
|
2430
|
+
# - exclusive minimum score is specified by prefixing `(`
|
|
2431
|
+
# @param [String] max
|
|
2432
|
+
# - inclusive maximum score is specified verbatim
|
|
2433
|
+
# - exclusive maximum score is specified by prefixing `(`
|
|
2434
|
+
# @return [Integer] number of members that were removed
|
|
2435
|
+
#
|
|
2436
|
+
# pkg:gem/redis#lib/redis/commands/sorted_sets.rb:691
|
|
2437
|
+
def zremrangebyscore(key, min, max); end
|
|
2438
|
+
|
|
2439
|
+
# Return a range of members in a sorted set, by index, with scores ordered
|
|
2440
|
+
# from high to low.
|
|
2441
|
+
#
|
|
2442
|
+
# @example Retrieve all members from a sorted set
|
|
2443
|
+
# redis.zrevrange("zset", 0, -1)
|
|
2444
|
+
# # => ["b", "a"]
|
|
2445
|
+
# @example Retrieve all members and their scores from a sorted set
|
|
2446
|
+
# redis.zrevrange("zset", 0, -1, :with_scores => true)
|
|
2447
|
+
# # => [["b", 64.0], ["a", 32.0]]
|
|
2448
|
+
#
|
|
2449
|
+
# @see #zrange
|
|
2450
|
+
#
|
|
2451
|
+
# pkg:gem/redis#lib/redis/commands/sorted_sets.rb:444
|
|
2452
|
+
def zrevrange(key, start, stop, withscores: T.unsafe(nil), with_scores: T.unsafe(nil)); end
|
|
2453
|
+
|
|
2454
|
+
# Return a range of members with the same score in a sorted set, by reversed lexicographical ordering.
|
|
2455
|
+
# Apart from the reversed ordering, #zrevrangebylex is similar to #zrangebylex.
|
|
2456
|
+
#
|
|
2457
|
+
# @example Retrieve members matching a
|
|
2458
|
+
# redis.zrevrangebylex("zset", "[a", "[a\xff")
|
|
2459
|
+
# # => ["abbygail", "abby", "abagael", "aaren"]
|
|
2460
|
+
# @example Retrieve the last 2 members matching a
|
|
2461
|
+
# redis.zrevrangebylex("zset", "[a", "[a\xff", :limit => [0, 2])
|
|
2462
|
+
# # => ["abbygail", "abby"]
|
|
2463
|
+
#
|
|
2464
|
+
# @see #zrangebylex
|
|
2465
|
+
#
|
|
2466
|
+
# pkg:gem/redis#lib/redis/commands/sorted_sets.rb:590
|
|
2467
|
+
def zrevrangebylex(key, max, min, limit: T.unsafe(nil)); end
|
|
2468
|
+
|
|
2469
|
+
# Return a range of members in a sorted set, by score, with scores ordered
|
|
2470
|
+
# from high to low.
|
|
2471
|
+
#
|
|
2472
|
+
# @example Retrieve members with score `< 100` and `>= 5`
|
|
2473
|
+
# redis.zrevrangebyscore("zset", "(100", "5")
|
|
2474
|
+
# # => ["b", "a"]
|
|
2475
|
+
# @example Retrieve the first 2 members with score `<= 0`
|
|
2476
|
+
# redis.zrevrangebyscore("zset", "0", "-inf", :limit => [0, 2])
|
|
2477
|
+
# # => ["b", "a"]
|
|
2478
|
+
# @example Retrieve members and their scores with scores `> 5`
|
|
2479
|
+
# redis.zrevrangebyscore("zset", "+inf", "(5", :with_scores => true)
|
|
2480
|
+
# # => [["b", 64.0], ["a", 32.0]]
|
|
2481
|
+
#
|
|
2482
|
+
# @see #zrangebyscore
|
|
2483
|
+
#
|
|
2484
|
+
# pkg:gem/redis#lib/redis/commands/sorted_sets.rb:658
|
|
2485
|
+
def zrevrangebyscore(key, max, min, withscores: T.unsafe(nil), with_scores: T.unsafe(nil), limit: T.unsafe(nil)); end
|
|
2486
|
+
|
|
2487
|
+
# Determine the index of a member in a sorted set, with scores ordered from
|
|
2488
|
+
# high to low.
|
|
2489
|
+
#
|
|
2490
|
+
# @example Retrieve member rank
|
|
2491
|
+
# redis.zrevrank("zset", "a")
|
|
2492
|
+
# # => 3
|
|
2493
|
+
# @example Retrieve member rank with their score
|
|
2494
|
+
# redis.zrevrank("zset", "a", :with_score => true)
|
|
2495
|
+
# # => [3, 32.0]
|
|
2496
|
+
#
|
|
2497
|
+
# @param [String] key
|
|
2498
|
+
# @param [String] member
|
|
2499
|
+
#
|
|
2500
|
+
# @return [Integer, [Integer, Float]]
|
|
2501
|
+
# - when `:with_score` is not specified, an Integer
|
|
2502
|
+
# - when `:with_score` is specified, a `[rank, score]` pair
|
|
2503
|
+
#
|
|
2504
|
+
# pkg:gem/redis#lib/redis/commands/sorted_sets.rb:497
|
|
2505
|
+
def zrevrank(key, member, withscore: T.unsafe(nil), with_score: T.unsafe(nil)); end
|
|
2506
|
+
|
|
2507
|
+
# Scan a sorted set
|
|
2508
|
+
#
|
|
2509
|
+
# @example Retrieve the first batch of key/value pairs in a hash
|
|
2510
|
+
# redis.zscan("zset", 0)
|
|
2511
|
+
#
|
|
2512
|
+
# @param [String, Integer] cursor the cursor of the iteration
|
|
2513
|
+
# @param [Hash] options
|
|
2514
|
+
# - `:match => String`: only return keys matching the pattern
|
|
2515
|
+
# - `:count => Integer`: return count keys at most per iteration
|
|
2516
|
+
#
|
|
2517
|
+
# @return [String, Array<[String, Float]>] the next cursor and all found
|
|
2518
|
+
# members and scores
|
|
2519
|
+
#
|
|
2520
|
+
# See the [Redis Server ZSCAN documentation](https://redis.io/docs/latest/commands/zscan/) for further details
|
|
2521
|
+
#
|
|
2522
|
+
# pkg:gem/redis#lib/redis/commands/sorted_sets.rb:856
|
|
2523
|
+
def zscan(key, cursor, **options); end
|
|
2524
|
+
|
|
2525
|
+
# Scan a sorted set
|
|
2526
|
+
#
|
|
2527
|
+
# @example Retrieve all of the members/scores in a sorted set
|
|
2528
|
+
# redis.zscan_each("zset").to_a
|
|
2529
|
+
# # => [["key70", "70"], ["key80", "80"]]
|
|
2530
|
+
#
|
|
2531
|
+
# @param [Hash] options
|
|
2532
|
+
# - `:match => String`: only return keys matching the pattern
|
|
2533
|
+
# - `:count => Integer`: return count keys at most per iteration
|
|
2534
|
+
#
|
|
2535
|
+
# @return [Enumerator] an enumerator for all found scores and members
|
|
2536
|
+
#
|
|
2537
|
+
# See the [Redis Server ZSCAN documentation](https://redis.io/docs/latest/commands/zscan/) for further details
|
|
2538
|
+
#
|
|
2539
|
+
# pkg:gem/redis#lib/redis/commands/sorted_sets.rb:875
|
|
2540
|
+
def zscan_each(key, **options, &block); end
|
|
2541
|
+
|
|
2542
|
+
# Get the score associated with the given member in a sorted set.
|
|
2543
|
+
#
|
|
2544
|
+
# @example Get the score for member "a"
|
|
2545
|
+
# redis.zscore("zset", "a")
|
|
2546
|
+
# # => 32.0
|
|
2547
|
+
#
|
|
2548
|
+
# @param [String] key
|
|
2549
|
+
# @param [String] member
|
|
2550
|
+
# @return [Float] score of the member
|
|
2551
|
+
#
|
|
2552
|
+
# pkg:gem/redis#lib/redis/commands/sorted_sets.rb:287
|
|
2553
|
+
def zscore(key, member); end
|
|
2554
|
+
|
|
2555
|
+
# Return the union of multiple sorted sets
|
|
2556
|
+
#
|
|
2557
|
+
# @example Retrieve the union of `2*zsetA` and `1*zsetB`
|
|
2558
|
+
# redis.zunion("zsetA", "zsetB", :weights => [2.0, 1.0])
|
|
2559
|
+
# # => ["v1", "v2"]
|
|
2560
|
+
# @example Retrieve the union of `2*zsetA` and `1*zsetB`, and their scores
|
|
2561
|
+
# redis.zunion("zsetA", "zsetB", :weights => [2.0, 1.0], :with_scores => true)
|
|
2562
|
+
# # => [["v1", 3.0], ["v2", 6.0]]
|
|
2563
|
+
#
|
|
2564
|
+
# @param [String, Array<String>] keys one or more keys to union
|
|
2565
|
+
# @param [Hash] options
|
|
2566
|
+
# - `:weights => [Array<Float>]`: weights to associate with source
|
|
2567
|
+
# sorted sets
|
|
2568
|
+
# - `:aggregate => String`: aggregate function to use (sum, min, max)
|
|
2569
|
+
# - `:with_scores => true`: include scores in output
|
|
2570
|
+
#
|
|
2571
|
+
# @return [Array<String>, Array<[String, Float]>]
|
|
2572
|
+
# - when `:with_scores` is not specified, an array of members
|
|
2573
|
+
# - when `:with_scores` is specified, an array with `[member, score]` pairs
|
|
2574
|
+
#
|
|
2575
|
+
# pkg:gem/redis#lib/redis/commands/sorted_sets.rb:778
|
|
2576
|
+
def zunion(*args, **_arg1); end
|
|
2577
|
+
|
|
2578
|
+
# Add multiple sorted sets and store the resulting sorted set in a new key.
|
|
2579
|
+
#
|
|
2580
|
+
# @example Compute the union of `2*zsetA` with `1*zsetB`, summing their scores
|
|
2581
|
+
# redis.zunionstore("zsetC", ["zsetA", "zsetB"], :weights => [2.0, 1.0], :aggregate => "sum")
|
|
2582
|
+
# # => 8
|
|
2583
|
+
#
|
|
2584
|
+
# @param [String] destination destination key
|
|
2585
|
+
# @param [Array<String>] keys source keys
|
|
2586
|
+
# @param [Hash] options
|
|
2587
|
+
# - `:weights => [Float, Float, ...]`: weights to associate with source
|
|
2588
|
+
# sorted sets
|
|
2589
|
+
# - `:aggregate => String`: aggregate function to use (sum, min, max, ...)
|
|
2590
|
+
# @return [Integer] number of elements in the resulting sorted set
|
|
2591
|
+
#
|
|
2592
|
+
# pkg:gem/redis#lib/redis/commands/sorted_sets.rb:796
|
|
2593
|
+
def zunionstore(*args, **_arg1); end
|
|
2594
|
+
|
|
2595
|
+
private
|
|
2596
|
+
|
|
2597
|
+
# pkg:gem/redis#lib/redis/commands/sorted_sets.rb:888
|
|
2598
|
+
def _zsets_operation(cmd, *keys, weights: T.unsafe(nil), aggregate: T.unsafe(nil), with_scores: T.unsafe(nil)); end
|
|
2599
|
+
|
|
2600
|
+
# pkg:gem/redis#lib/redis/commands/sorted_sets.rb:907
|
|
2601
|
+
def _zsets_operation_store(cmd, destination, keys, weights: T.unsafe(nil), aggregate: T.unsafe(nil)); end
|
|
2602
|
+
end
|
|
2603
|
+
|
|
2604
|
+
# pkg:gem/redis#lib/redis/commands/streams.rb:5
|
|
2605
|
+
module Redis::Commands::Streams
|
|
2606
|
+
# Removes one or multiple entries from the pending entries list of a stream consumer group.
|
|
2607
|
+
#
|
|
2608
|
+
# @example With a entry id
|
|
2609
|
+
# redis.xack('mystream', 'mygroup', '1526569495631-0')
|
|
2610
|
+
# @example With splatted entry ids
|
|
2611
|
+
# redis.xack('mystream', 'mygroup', '0-1', '0-2')
|
|
2612
|
+
# @example With arrayed entry ids
|
|
2613
|
+
# redis.xack('mystream', 'mygroup', %w[0-1 0-2])
|
|
2614
|
+
#
|
|
2615
|
+
# @param key [String] the stream key
|
|
2616
|
+
# @param group [String] the consumer group name
|
|
2617
|
+
# @param ids [Array<String>] one or multiple entry ids
|
|
2618
|
+
#
|
|
2619
|
+
# @return [Integer] the number of entries successfully acknowledged
|
|
2620
|
+
#
|
|
2621
|
+
# pkg:gem/redis#lib/redis/commands/streams.rb:273
|
|
2622
|
+
def xack(key, group, *ids); end
|
|
2623
|
+
|
|
2624
|
+
# Add new entry to the stream.
|
|
2625
|
+
#
|
|
2626
|
+
# @example Without options
|
|
2627
|
+
# redis.xadd('mystream', f1: 'v1', f2: 'v2')
|
|
2628
|
+
# @example With options
|
|
2629
|
+
# redis.xadd('mystream', { f1: 'v1', f2: 'v2' }, id: '0-0', maxlen: 1000, approximate: true, nomkstream: true)
|
|
2630
|
+
#
|
|
2631
|
+
# @param key [String] the stream key
|
|
2632
|
+
# @param entry [Hash] one or multiple field-value pairs
|
|
2633
|
+
# @param opts [Hash] several options for `XADD` command
|
|
2634
|
+
#
|
|
2635
|
+
# @option opts [String] :id the entry id, default value is `*`, it means auto generation
|
|
2636
|
+
# @option opts [Integer] :maxlen max length of entries to keep
|
|
2637
|
+
# @option opts [Integer] :minid min id of entries to keep
|
|
2638
|
+
# @option opts [Boolean] :approximate whether to add `~` modifier of maxlen/minid or not
|
|
2639
|
+
# @option opts [Boolean] :nomkstream whether to add NOMKSTREAM, default is not to add
|
|
2640
|
+
#
|
|
2641
|
+
# @return [String] the entry id
|
|
2642
|
+
#
|
|
2643
|
+
# pkg:gem/redis#lib/redis/commands/streams.rb:50
|
|
2644
|
+
def xadd(key, entry, approximate: T.unsafe(nil), maxlen: T.unsafe(nil), minid: T.unsafe(nil), nomkstream: T.unsafe(nil), id: T.unsafe(nil)); end
|
|
2645
|
+
|
|
2646
|
+
# Transfers ownership of pending stream entries that match the specified criteria.
|
|
2647
|
+
#
|
|
2648
|
+
# @example Claim next pending message stuck > 5 minutes and mark as retry
|
|
2649
|
+
# redis.xautoclaim('mystream', 'mygroup', 'consumer1', 3600000, '0-0')
|
|
2650
|
+
# @example Claim 50 next pending messages stuck > 5 minutes and mark as retry
|
|
2651
|
+
# redis.xclaim('mystream', 'mygroup', 'consumer1', 3600000, '0-0', count: 50)
|
|
2652
|
+
# @example Claim next pending message stuck > 5 minutes and don't mark as retry
|
|
2653
|
+
# redis.xclaim('mystream', 'mygroup', 'consumer1', 3600000, '0-0', justid: true)
|
|
2654
|
+
# @example Claim next pending message after this id stuck > 5 minutes and mark as retry
|
|
2655
|
+
# redis.xautoclaim('mystream', 'mygroup', 'consumer1', 3600000, '1641321233-0')
|
|
2656
|
+
#
|
|
2657
|
+
# @param key [String] the stream key
|
|
2658
|
+
# @param group [String] the consumer group name
|
|
2659
|
+
# @param consumer [String] the consumer name
|
|
2660
|
+
# @param min_idle_time [Integer] the number of milliseconds
|
|
2661
|
+
# @param start [String] entry id to start scanning from or 0-0 for everything
|
|
2662
|
+
# @param count [Integer] number of messages to claim (default 1)
|
|
2663
|
+
# @param justid [Boolean] whether to fetch just an array of entry ids or not.
|
|
2664
|
+
# Does not increment retry count when true
|
|
2665
|
+
#
|
|
2666
|
+
# @return [Hash{String => Hash}] the entries successfully claimed
|
|
2667
|
+
# @return [Array<String>] the entry ids successfully claimed if justid option is `true`
|
|
2668
|
+
#
|
|
2669
|
+
# pkg:gem/redis#lib/redis/commands/streams.rb:343
|
|
2670
|
+
def xautoclaim(key, group, consumer, min_idle_time, start, count: T.unsafe(nil), justid: T.unsafe(nil)); end
|
|
2671
|
+
|
|
2672
|
+
# Changes the ownership of a pending entry
|
|
2673
|
+
#
|
|
2674
|
+
# @example With splatted entry ids
|
|
2675
|
+
# redis.xclaim('mystream', 'mygroup', 'consumer1', 3600000, '0-1', '0-2')
|
|
2676
|
+
# @example With arrayed entry ids
|
|
2677
|
+
# redis.xclaim('mystream', 'mygroup', 'consumer1', 3600000, %w[0-1 0-2])
|
|
2678
|
+
# @example With idle option
|
|
2679
|
+
# redis.xclaim('mystream', 'mygroup', 'consumer1', 3600000, %w[0-1 0-2], idle: 1000)
|
|
2680
|
+
# @example With time option
|
|
2681
|
+
# redis.xclaim('mystream', 'mygroup', 'consumer1', 3600000, %w[0-1 0-2], time: 1542866959000)
|
|
2682
|
+
# @example With retrycount option
|
|
2683
|
+
# redis.xclaim('mystream', 'mygroup', 'consumer1', 3600000, %w[0-1 0-2], retrycount: 10)
|
|
2684
|
+
# @example With force option
|
|
2685
|
+
# redis.xclaim('mystream', 'mygroup', 'consumer1', 3600000, %w[0-1 0-2], force: true)
|
|
2686
|
+
# @example With justid option
|
|
2687
|
+
# redis.xclaim('mystream', 'mygroup', 'consumer1', 3600000, %w[0-1 0-2], justid: true)
|
|
2688
|
+
#
|
|
2689
|
+
# @param key [String] the stream key
|
|
2690
|
+
# @param group [String] the consumer group name
|
|
2691
|
+
# @param consumer [String] the consumer name
|
|
2692
|
+
# @param min_idle_time [Integer] the number of milliseconds
|
|
2693
|
+
# @param ids [Array<String>] one or multiple entry ids
|
|
2694
|
+
# @param opts [Hash] several options for `XCLAIM` command
|
|
2695
|
+
#
|
|
2696
|
+
# @option opts [Integer] :idle the number of milliseconds as last time it was delivered of the entry
|
|
2697
|
+
# @option opts [Integer] :time the number of milliseconds as a specific Unix Epoch time
|
|
2698
|
+
# @option opts [Integer] :retrycount the number of retry counter
|
|
2699
|
+
# @option opts [Boolean] :force whether to create the pending entry to the pending entries list or not
|
|
2700
|
+
# @option opts [Boolean] :justid whether to fetch just an array of entry ids or not
|
|
2701
|
+
#
|
|
2702
|
+
# @return [Hash{String => Hash}] the entries successfully claimed
|
|
2703
|
+
# @return [Array<String>] the entry ids successfully claimed if justid option is `true`
|
|
2704
|
+
#
|
|
2705
|
+
# pkg:gem/redis#lib/redis/commands/streams.rb:310
|
|
2706
|
+
def xclaim(key, group, consumer, min_idle_time, *ids, **opts); end
|
|
2707
|
+
|
|
2708
|
+
# Delete entries by entry ids.
|
|
2709
|
+
#
|
|
2710
|
+
# @example With splatted entry ids
|
|
2711
|
+
# redis.xdel('mystream', '0-1', '0-2')
|
|
2712
|
+
# @example With arrayed entry ids
|
|
2713
|
+
# redis.xdel('mystream', ['0-1', '0-2'])
|
|
2714
|
+
#
|
|
2715
|
+
# @param key [String] the stream key
|
|
2716
|
+
# @param ids [Array<String>] one or multiple entry ids
|
|
2717
|
+
#
|
|
2718
|
+
# @return [Integer] the number of entries actually deleted
|
|
2719
|
+
#
|
|
2720
|
+
# pkg:gem/redis#lib/redis/commands/streams.rb:113
|
|
2721
|
+
def xdel(key, *ids); end
|
|
2722
|
+
|
|
2723
|
+
# Manages the consumer group of the stream.
|
|
2724
|
+
#
|
|
2725
|
+
# @example With `create` subcommand
|
|
2726
|
+
# redis.xgroup(:create, 'mystream', 'mygroup', '$')
|
|
2727
|
+
# @example With `setid` subcommand
|
|
2728
|
+
# redis.xgroup(:setid, 'mystream', 'mygroup', '$')
|
|
2729
|
+
# @example With `destroy` subcommand
|
|
2730
|
+
# redis.xgroup(:destroy, 'mystream', 'mygroup')
|
|
2731
|
+
# @example With `delconsumer` subcommand
|
|
2732
|
+
# redis.xgroup(:delconsumer, 'mystream', 'mygroup', 'consumer1')
|
|
2733
|
+
#
|
|
2734
|
+
# @param subcommand [String] `create` `setid` `destroy` `delconsumer`
|
|
2735
|
+
# @param key [String] the stream key
|
|
2736
|
+
# @param group [String] the consumer group name
|
|
2737
|
+
# @param id_or_consumer [String]
|
|
2738
|
+
# * the entry id or `$`, required if subcommand is `create` or `setid`
|
|
2739
|
+
# * the consumer name, required if subcommand is `delconsumer`
|
|
2740
|
+
# @param mkstream [Boolean] whether to create an empty stream automatically or not
|
|
2741
|
+
#
|
|
2742
|
+
# @return [String] `OK` if subcommand is `create` or `setid`
|
|
2743
|
+
# @return [Integer] effected count if subcommand is `destroy` or `delconsumer`
|
|
2744
|
+
#
|
|
2745
|
+
# pkg:gem/redis#lib/redis/commands/streams.rb:221
|
|
2746
|
+
def xgroup(subcommand, key, group, id_or_consumer = T.unsafe(nil), mkstream: T.unsafe(nil)); end
|
|
2747
|
+
|
|
2748
|
+
# Returns the stream information each subcommand.
|
|
2749
|
+
#
|
|
2750
|
+
# @example stream
|
|
2751
|
+
# redis.xinfo(:stream, 'mystream')
|
|
2752
|
+
# @example groups
|
|
2753
|
+
# redis.xinfo(:groups, 'mystream')
|
|
2754
|
+
# @example consumers
|
|
2755
|
+
# redis.xinfo(:consumers, 'mystream', 'mygroup')
|
|
2756
|
+
#
|
|
2757
|
+
# @param subcommand [String] e.g. `stream` `groups` `consumers`
|
|
2758
|
+
# @param key [String] the stream key
|
|
2759
|
+
# @param group [String] the consumer group name, required if subcommand is `consumers`
|
|
2760
|
+
#
|
|
2761
|
+
# @return [Hash] information of the stream if subcommand is `stream`
|
|
2762
|
+
# @return [Array<Hash>] information of the consumer groups if subcommand is `groups`
|
|
2763
|
+
# @return [Array<Hash>] information of the consumers if subcommand is `consumers`
|
|
2764
|
+
#
|
|
2765
|
+
# pkg:gem/redis#lib/redis/commands/streams.rb:22
|
|
2766
|
+
def xinfo(subcommand, key, group = T.unsafe(nil)); end
|
|
2767
|
+
|
|
2768
|
+
# Returns the number of entries inside a stream.
|
|
2769
|
+
#
|
|
2770
|
+
# @example With key
|
|
2771
|
+
# redis.xlen('mystream')
|
|
2772
|
+
#
|
|
2773
|
+
# @param key [String] the stream key
|
|
2774
|
+
#
|
|
2775
|
+
# @return [Integer] the number of entries
|
|
2776
|
+
#
|
|
2777
|
+
# pkg:gem/redis#lib/redis/commands/streams.rb:172
|
|
2778
|
+
def xlen(key); end
|
|
2779
|
+
|
|
2780
|
+
# Fetches not acknowledging pending entries
|
|
2781
|
+
#
|
|
2782
|
+
# @example With key and group
|
|
2783
|
+
# redis.xpending('mystream', 'mygroup')
|
|
2784
|
+
# @example With range options
|
|
2785
|
+
# redis.xpending('mystream', 'mygroup', '-', '+', 10)
|
|
2786
|
+
# @example With range and idle time options
|
|
2787
|
+
# redis.xpending('mystream', 'mygroup', '-', '+', 10, idle: 9000)
|
|
2788
|
+
# @example With range and consumer options
|
|
2789
|
+
# redis.xpending('mystream', 'mygroup', '-', '+', 10, 'consumer1')
|
|
2790
|
+
#
|
|
2791
|
+
# @param key [String] the stream key
|
|
2792
|
+
# @param group [String] the consumer group name
|
|
2793
|
+
# @param start [String] start first entry id of range
|
|
2794
|
+
# @param end [String] end last entry id of range
|
|
2795
|
+
# @param count [Integer] count the number of entries as limit
|
|
2796
|
+
# @param consumer [String] the consumer name
|
|
2797
|
+
#
|
|
2798
|
+
# @option opts [Integer] :idle pending message minimum idle time in milliseconds
|
|
2799
|
+
#
|
|
2800
|
+
# @return [Hash] the summary of pending entries
|
|
2801
|
+
# @return [Array<Hash>] the pending entries details if options were specified
|
|
2802
|
+
#
|
|
2803
|
+
# pkg:gem/redis#lib/redis/commands/streams.rb:375
|
|
2804
|
+
def xpending(key, group, *args, idle: T.unsafe(nil)); end
|
|
2805
|
+
|
|
2806
|
+
# Fetches entries of the stream in ascending order.
|
|
2807
|
+
#
|
|
2808
|
+
# @example Without options
|
|
2809
|
+
# redis.xrange('mystream')
|
|
2810
|
+
# @example With a specific start
|
|
2811
|
+
# redis.xrange('mystream', '0-1')
|
|
2812
|
+
# @example With a specific start and end
|
|
2813
|
+
# redis.xrange('mystream', '0-1', '0-3')
|
|
2814
|
+
# @example With count options
|
|
2815
|
+
# redis.xrange('mystream', count: 10)
|
|
2816
|
+
#
|
|
2817
|
+
# @param key [String] the stream key
|
|
2818
|
+
# @param start [String] first entry id of range, default value is `-`
|
|
2819
|
+
# @param end [String] last entry id of range, default value is `+`
|
|
2820
|
+
# @param count [Integer] the number of entries as limit
|
|
2821
|
+
#
|
|
2822
|
+
# @return [Array<Array<String, Hash>>] the ids and entries pairs
|
|
2823
|
+
#
|
|
2824
|
+
# pkg:gem/redis#lib/redis/commands/streams.rb:135
|
|
2825
|
+
def xrange(key, start = T.unsafe(nil), range_end = T.unsafe(nil), count: T.unsafe(nil)); end
|
|
2826
|
+
|
|
2827
|
+
# Fetches entries from one or multiple streams. Optionally blocking.
|
|
2828
|
+
#
|
|
2829
|
+
# @example With a key
|
|
2830
|
+
# redis.xread('mystream', '0-0')
|
|
2831
|
+
# @example With multiple keys
|
|
2832
|
+
# redis.xread(%w[mystream1 mystream2], %w[0-0 0-0])
|
|
2833
|
+
# @example With count option
|
|
2834
|
+
# redis.xread('mystream', '0-0', count: 2)
|
|
2835
|
+
# @example With block option
|
|
2836
|
+
# redis.xread('mystream', '$', block: 1000)
|
|
2837
|
+
#
|
|
2838
|
+
# @param keys [Array<String>] one or multiple stream keys
|
|
2839
|
+
# @param ids [Array<String>] one or multiple entry ids
|
|
2840
|
+
# @param count [Integer] the number of entries as limit per stream
|
|
2841
|
+
# @param block [Integer] the number of milliseconds as blocking timeout
|
|
2842
|
+
#
|
|
2843
|
+
# @return [Hash{String => Hash{String => Hash}}] the entries
|
|
2844
|
+
#
|
|
2845
|
+
# pkg:gem/redis#lib/redis/commands/streams.rb:193
|
|
2846
|
+
def xread(keys, ids, count: T.unsafe(nil), block: T.unsafe(nil)); end
|
|
2847
|
+
|
|
2848
|
+
# Fetches a subset of the entries from one or multiple streams related with the consumer group.
|
|
2849
|
+
# Optionally blocking.
|
|
2850
|
+
#
|
|
2851
|
+
# @example With a key
|
|
2852
|
+
# redis.xreadgroup('mygroup', 'consumer1', 'mystream', '>')
|
|
2853
|
+
# @example With multiple keys
|
|
2854
|
+
# redis.xreadgroup('mygroup', 'consumer1', %w[mystream1 mystream2], %w[> >])
|
|
2855
|
+
# @example With count option
|
|
2856
|
+
# redis.xreadgroup('mygroup', 'consumer1', 'mystream', '>', count: 2)
|
|
2857
|
+
# @example With block option
|
|
2858
|
+
# redis.xreadgroup('mygroup', 'consumer1', 'mystream', '>', block: 1000)
|
|
2859
|
+
# @example With noack option
|
|
2860
|
+
# redis.xreadgroup('mygroup', 'consumer1', 'mystream', '>', noack: true)
|
|
2861
|
+
#
|
|
2862
|
+
# @param group [String] the consumer group name
|
|
2863
|
+
# @param consumer [String] the consumer name
|
|
2864
|
+
# @param keys [Array<String>] one or multiple stream keys
|
|
2865
|
+
# @param ids [Array<String>] one or multiple entry ids
|
|
2866
|
+
# @param opts [Hash] several options for `XREADGROUP` command
|
|
2867
|
+
#
|
|
2868
|
+
# @option opts [Integer] :count the number of entries as limit
|
|
2869
|
+
# @option opts [Integer] :block the number of milliseconds as blocking timeout
|
|
2870
|
+
# @option opts [Boolean] :noack whether message loss is acceptable or not
|
|
2871
|
+
#
|
|
2872
|
+
# @return [Hash{String => Hash{String => Hash}}] the entries
|
|
2873
|
+
#
|
|
2874
|
+
# pkg:gem/redis#lib/redis/commands/streams.rb:251
|
|
2875
|
+
def xreadgroup(group, consumer, keys, ids, count: T.unsafe(nil), block: T.unsafe(nil), noack: T.unsafe(nil)); end
|
|
2876
|
+
|
|
2877
|
+
# Fetches entries of the stream in descending order.
|
|
2878
|
+
#
|
|
2879
|
+
# @example Without options
|
|
2880
|
+
# redis.xrevrange('mystream')
|
|
2881
|
+
# @example With a specific end
|
|
2882
|
+
# redis.xrevrange('mystream', '0-3')
|
|
2883
|
+
# @example With a specific end and start
|
|
2884
|
+
# redis.xrevrange('mystream', '0-3', '0-1')
|
|
2885
|
+
# @example With count options
|
|
2886
|
+
# redis.xrevrange('mystream', count: 10)
|
|
2887
|
+
#
|
|
2888
|
+
# @param key [String] the stream key
|
|
2889
|
+
# @param end [String] first entry id of range, default value is `+`
|
|
2890
|
+
# @param start [String] last entry id of range, default value is `-`
|
|
2891
|
+
# @params count [Integer] the number of entries as limit
|
|
2892
|
+
#
|
|
2893
|
+
# @return [Array<Array<String, Hash>>] the ids and entries pairs
|
|
2894
|
+
#
|
|
2895
|
+
# pkg:gem/redis#lib/redis/commands/streams.rb:158
|
|
2896
|
+
def xrevrange(key, range_end = T.unsafe(nil), start = T.unsafe(nil), count: T.unsafe(nil)); end
|
|
2897
|
+
|
|
2898
|
+
# Trims older entries of the stream if needed.
|
|
2899
|
+
#
|
|
2900
|
+
# @example Without options
|
|
2901
|
+
# redis.xtrim('mystream', 1000)
|
|
2902
|
+
# @example With options
|
|
2903
|
+
# redis.xtrim('mystream', 1000, approximate: true)
|
|
2904
|
+
# @example With strategy
|
|
2905
|
+
# redis.xtrim('mystream', '1-0', strategy: 'MINID')
|
|
2906
|
+
#
|
|
2907
|
+
# @overload xtrim(key, maxlen, strategy: 'MAXLEN', approximate: true)
|
|
2908
|
+
# @param key [String] the stream key
|
|
2909
|
+
# @param maxlen [Integer] max length of entries
|
|
2910
|
+
# @param strategy [String] the limit strategy, must be MAXLEN
|
|
2911
|
+
# @param approximate [Boolean] whether to add `~` modifier of maxlen or not
|
|
2912
|
+
# @param limit [Integer] maximum count of entries to be evicted
|
|
2913
|
+
# @overload xtrim(key, minid, strategy: 'MINID', approximate: true)
|
|
2914
|
+
# @param key [String] the stream key
|
|
2915
|
+
# @param minid [String] minimum id of entries
|
|
2916
|
+
# @param strategy [String] the limit strategy, must be MINID
|
|
2917
|
+
# @param approximate [Boolean] whether to add `~` modifier of minid or not
|
|
2918
|
+
# @param limit [Integer] maximum count of entries to be evicted
|
|
2919
|
+
#
|
|
2920
|
+
# @return [Integer] the number of entries actually deleted
|
|
2921
|
+
#
|
|
2922
|
+
# pkg:gem/redis#lib/redis/commands/streams.rb:92
|
|
2923
|
+
def xtrim(key, len_or_id, strategy: T.unsafe(nil), approximate: T.unsafe(nil), limit: T.unsafe(nil)); end
|
|
2924
|
+
|
|
2925
|
+
private
|
|
2926
|
+
|
|
2927
|
+
# pkg:gem/redis#lib/redis/commands/streams.rb:392
|
|
2928
|
+
def _xread(args, keys, ids, blocking_timeout_msec); end
|
|
2929
|
+
end
|
|
2930
|
+
|
|
2931
|
+
# pkg:gem/redis#lib/redis/commands/strings.rb:5
|
|
2932
|
+
module Redis::Commands::Strings
|
|
2933
|
+
# Append a value to a key.
|
|
2934
|
+
#
|
|
2935
|
+
# @param [String] key
|
|
2936
|
+
# @param [String] value value to append
|
|
2937
|
+
# @return [Integer] length of the string after appending
|
|
2938
|
+
#
|
|
2939
|
+
# pkg:gem/redis#lib/redis/commands/strings.rb:255
|
|
2940
|
+
def append(key, value); end
|
|
2941
|
+
|
|
2942
|
+
# Decrement the integer value of a key by one.
|
|
2943
|
+
#
|
|
2944
|
+
# @example
|
|
2945
|
+
# redis.decr("value")
|
|
2946
|
+
# # => 4
|
|
2947
|
+
#
|
|
2948
|
+
# @param [String] key
|
|
2949
|
+
# @return [Integer] value after decrementing it
|
|
2950
|
+
#
|
|
2951
|
+
# pkg:gem/redis#lib/redis/commands/strings.rb:14
|
|
2952
|
+
def decr(key); end
|
|
2953
|
+
|
|
2954
|
+
# Decrement the integer value of a key by the given number.
|
|
2955
|
+
#
|
|
2956
|
+
# @example
|
|
2957
|
+
# redis.decrby("value", 5)
|
|
2958
|
+
# # => 0
|
|
2959
|
+
#
|
|
2960
|
+
# @param [String] key
|
|
2961
|
+
# @param [Integer] decrement
|
|
2962
|
+
# @return [Integer] value after decrementing it
|
|
2963
|
+
#
|
|
2964
|
+
# pkg:gem/redis#lib/redis/commands/strings.rb:27
|
|
2965
|
+
def decrby(key, decrement); end
|
|
2966
|
+
|
|
2967
|
+
# Get the value of a key.
|
|
2968
|
+
#
|
|
2969
|
+
# @param [String] key
|
|
2970
|
+
# @return [String]
|
|
2971
|
+
#
|
|
2972
|
+
# pkg:gem/redis#lib/redis/commands/strings.rb:190
|
|
2973
|
+
def get(key); end
|
|
2974
|
+
|
|
2975
|
+
# Get the value of key and delete the key. This command is similar to GET,
|
|
2976
|
+
# except for the fact that it also deletes the key on success.
|
|
2977
|
+
#
|
|
2978
|
+
# @param [String] key
|
|
2979
|
+
# @return [String] the old value stored in the key, or `nil` if the key
|
|
2980
|
+
# did not exist
|
|
2981
|
+
#
|
|
2982
|
+
# pkg:gem/redis#lib/redis/commands/strings.rb:275
|
|
2983
|
+
def getdel(key); end
|
|
2984
|
+
|
|
2985
|
+
# Get the value of key and optionally set its expiration. GETEX is similar to
|
|
2986
|
+
# GET, but is a write command with additional options. When no options are
|
|
2987
|
+
# provided, GETEX behaves like GET.
|
|
2988
|
+
#
|
|
2989
|
+
# @param [String] key
|
|
2990
|
+
# @param [Hash] options
|
|
2991
|
+
# - `:ex => Integer`: Set the specified expire time, in seconds.
|
|
2992
|
+
# - `:px => Integer`: Set the specified expire time, in milliseconds.
|
|
2993
|
+
# - `:exat => true`: Set the specified Unix time at which the key will
|
|
2994
|
+
# expire, in seconds.
|
|
2995
|
+
# - `:pxat => true`: Set the specified Unix time at which the key will
|
|
2996
|
+
# expire, in milliseconds.
|
|
2997
|
+
# - `:persist => true`: Remove the time to live associated with the key.
|
|
2998
|
+
# @return [String] The value of key, or nil when key does not exist.
|
|
2999
|
+
#
|
|
3000
|
+
# pkg:gem/redis#lib/redis/commands/strings.rb:293
|
|
3001
|
+
def getex(key, ex: T.unsafe(nil), px: T.unsafe(nil), exat: T.unsafe(nil), pxat: T.unsafe(nil), persist: T.unsafe(nil)); end
|
|
3002
|
+
|
|
3003
|
+
# Get a substring of the string stored at a key.
|
|
3004
|
+
#
|
|
3005
|
+
# @param [String] key
|
|
3006
|
+
# @param [Integer] start zero-based start offset
|
|
3007
|
+
# @param [Integer] stop zero-based end offset. Use -1 for representing
|
|
3008
|
+
# the end of the string
|
|
3009
|
+
# @return [Integer] `0` or `1`
|
|
3010
|
+
#
|
|
3011
|
+
# pkg:gem/redis#lib/redis/commands/strings.rb:246
|
|
3012
|
+
def getrange(key, start, stop); end
|
|
3013
|
+
|
|
3014
|
+
# Set the string value of a key and return its old value.
|
|
3015
|
+
#
|
|
3016
|
+
# @param [String] key
|
|
3017
|
+
# @param [String] value value to replace the current value with
|
|
3018
|
+
# @return [String] the old value stored in the key, or `nil` if the key
|
|
3019
|
+
# did not exist
|
|
3020
|
+
#
|
|
3021
|
+
# pkg:gem/redis#lib/redis/commands/strings.rb:265
|
|
3022
|
+
def getset(key, value); end
|
|
3023
|
+
|
|
3024
|
+
# Increment the integer value of a key by one.
|
|
3025
|
+
#
|
|
3026
|
+
# @example
|
|
3027
|
+
# redis.incr("value")
|
|
3028
|
+
# # => 6
|
|
3029
|
+
#
|
|
3030
|
+
# @param [String] key
|
|
3031
|
+
# @return [Integer] value after incrementing it
|
|
3032
|
+
#
|
|
3033
|
+
# pkg:gem/redis#lib/redis/commands/strings.rb:39
|
|
3034
|
+
def incr(key); end
|
|
3035
|
+
|
|
3036
|
+
# Increment the integer value of a key by the given integer number.
|
|
3037
|
+
#
|
|
3038
|
+
# @example
|
|
3039
|
+
# redis.incrby("value", 5)
|
|
3040
|
+
# # => 10
|
|
3041
|
+
#
|
|
3042
|
+
# @param [String] key
|
|
3043
|
+
# @param [Integer] increment
|
|
3044
|
+
# @return [Integer] value after incrementing it
|
|
3045
|
+
#
|
|
3046
|
+
# pkg:gem/redis#lib/redis/commands/strings.rb:52
|
|
3047
|
+
def incrby(key, increment); end
|
|
3048
|
+
|
|
3049
|
+
# Increment the numeric value of a key by the given float number.
|
|
3050
|
+
#
|
|
3051
|
+
# @example
|
|
3052
|
+
# redis.incrbyfloat("value", 1.23)
|
|
3053
|
+
# # => 1.23
|
|
3054
|
+
#
|
|
3055
|
+
# @param [String] key
|
|
3056
|
+
# @param [Float] increment
|
|
3057
|
+
# @return [Float] value after incrementing it
|
|
3058
|
+
#
|
|
3059
|
+
# pkg:gem/redis#lib/redis/commands/strings.rb:65
|
|
3060
|
+
def incrbyfloat(key, increment); end
|
|
3061
|
+
|
|
3062
|
+
# Get the values of all the given keys.
|
|
3063
|
+
#
|
|
3064
|
+
# @example
|
|
3065
|
+
# redis.mapped_mget("key1", "key2")
|
|
3066
|
+
# # => { "key1" => "v1", "key2" => "v2" }
|
|
3067
|
+
#
|
|
3068
|
+
# @param [Array<String>] keys array of keys
|
|
3069
|
+
# @return [Hash] a hash mapping the specified keys to their values
|
|
3070
|
+
#
|
|
3071
|
+
# @see #mget
|
|
3072
|
+
#
|
|
3073
|
+
# pkg:gem/redis#lib/redis/commands/strings.rb:219
|
|
3074
|
+
def mapped_mget(*keys); end
|
|
3075
|
+
|
|
3076
|
+
# Set one or more values.
|
|
3077
|
+
#
|
|
3078
|
+
# @example
|
|
3079
|
+
# redis.mapped_mset({ "f1" => "v1", "f2" => "v2" })
|
|
3080
|
+
# # => "OK"
|
|
3081
|
+
#
|
|
3082
|
+
# @param [Hash] hash keys mapping to values
|
|
3083
|
+
# @return [String] `"OK"`
|
|
3084
|
+
#
|
|
3085
|
+
# @see #mset
|
|
3086
|
+
#
|
|
3087
|
+
# pkg:gem/redis#lib/redis/commands/strings.rb:154
|
|
3088
|
+
def mapped_mset(hash); end
|
|
3089
|
+
|
|
3090
|
+
# Set one or more values, only if none of the keys exist.
|
|
3091
|
+
#
|
|
3092
|
+
# @example
|
|
3093
|
+
# redis.mapped_msetnx({ "key1" => "v1", "key2" => "v2" })
|
|
3094
|
+
# # => true
|
|
3095
|
+
#
|
|
3096
|
+
# @param [Hash] hash keys mapping to values
|
|
3097
|
+
# @return [Boolean] whether or not all values were set
|
|
3098
|
+
#
|
|
3099
|
+
# @see #msetnx
|
|
3100
|
+
#
|
|
3101
|
+
# pkg:gem/redis#lib/redis/commands/strings.rb:182
|
|
3102
|
+
def mapped_msetnx(hash); end
|
|
3103
|
+
|
|
3104
|
+
# Get the values of all the given keys.
|
|
3105
|
+
#
|
|
3106
|
+
# @example
|
|
3107
|
+
# redis.mget("key1", "key2")
|
|
3108
|
+
# # => ["v1", "v2"]
|
|
3109
|
+
#
|
|
3110
|
+
# @param [Array<String>] keys
|
|
3111
|
+
# @return [Array<String>] an array of values for the specified keys
|
|
3112
|
+
#
|
|
3113
|
+
# @see #mapped_mget
|
|
3114
|
+
#
|
|
3115
|
+
# pkg:gem/redis#lib/redis/commands/strings.rb:204
|
|
3116
|
+
def mget(*keys, &blk); end
|
|
3117
|
+
|
|
3118
|
+
# Set one or more values.
|
|
3119
|
+
#
|
|
3120
|
+
# @example
|
|
3121
|
+
# redis.mset("key1", "v1", "key2", "v2")
|
|
3122
|
+
# # => "OK"
|
|
3123
|
+
#
|
|
3124
|
+
# @param [Array<String>] args array of keys and values
|
|
3125
|
+
# @return [String] `"OK"`
|
|
3126
|
+
#
|
|
3127
|
+
# @see #mapped_mset
|
|
3128
|
+
#
|
|
3129
|
+
# pkg:gem/redis#lib/redis/commands/strings.rb:140
|
|
3130
|
+
def mset(*args); end
|
|
3131
|
+
|
|
3132
|
+
# Set one or more values, only if none of the keys exist.
|
|
3133
|
+
#
|
|
3134
|
+
# @example
|
|
3135
|
+
# redis.msetnx("key1", "v1", "key2", "v2")
|
|
3136
|
+
# # => true
|
|
3137
|
+
#
|
|
3138
|
+
# @param [Array<String>] args array of keys and values
|
|
3139
|
+
# @return [Boolean] whether or not all values were set
|
|
3140
|
+
#
|
|
3141
|
+
# @see #mapped_msetnx
|
|
3142
|
+
#
|
|
3143
|
+
# pkg:gem/redis#lib/redis/commands/strings.rb:168
|
|
3144
|
+
def msetnx(*args); end
|
|
3145
|
+
|
|
3146
|
+
# Set the time to live in milliseconds of a key.
|
|
3147
|
+
#
|
|
3148
|
+
# @param [String] key
|
|
3149
|
+
# @param [Integer] ttl
|
|
3150
|
+
# @param [String] value
|
|
3151
|
+
# @return [String] `"OK"`
|
|
3152
|
+
#
|
|
3153
|
+
# pkg:gem/redis#lib/redis/commands/strings.rb:117
|
|
3154
|
+
def psetex(key, ttl, value); end
|
|
3155
|
+
|
|
3156
|
+
# Set the string value of a key.
|
|
3157
|
+
#
|
|
3158
|
+
# @param [String] key
|
|
3159
|
+
# @param [String] value
|
|
3160
|
+
# @param [Hash] options
|
|
3161
|
+
# - `:ex => Integer`: Set the specified expire time, in seconds.
|
|
3162
|
+
# - `:px => Integer`: Set the specified expire time, in milliseconds.
|
|
3163
|
+
# - `:exat => Integer` : Set the specified Unix time at which the key will expire, in seconds.
|
|
3164
|
+
# - `:pxat => Integer` : Set the specified Unix time at which the key will expire, in milliseconds.
|
|
3165
|
+
# - `:nx => true`: Only set the key if it does not already exist.
|
|
3166
|
+
# - `:xx => true`: Only set the key if it already exist.
|
|
3167
|
+
# - `:keepttl => true`: Retain the time to live associated with the key.
|
|
3168
|
+
# - `:get => true`: Return the old string stored at key, or nil if key did not exist.
|
|
3169
|
+
# @return [String, Boolean] `"OK"` or true, false if `:nx => true` or `:xx => true`
|
|
3170
|
+
#
|
|
3171
|
+
# pkg:gem/redis#lib/redis/commands/strings.rb:83
|
|
3172
|
+
def set(key, value, ex: T.unsafe(nil), px: T.unsafe(nil), exat: T.unsafe(nil), pxat: T.unsafe(nil), nx: T.unsafe(nil), xx: T.unsafe(nil), keepttl: T.unsafe(nil), get: T.unsafe(nil)); end
|
|
3173
|
+
|
|
3174
|
+
# Set the time to live in seconds of a key.
|
|
3175
|
+
#
|
|
3176
|
+
# @param [String] key
|
|
3177
|
+
# @param [Integer] ttl
|
|
3178
|
+
# @param [String] value
|
|
3179
|
+
# @return [String] `"OK"`
|
|
3180
|
+
#
|
|
3181
|
+
# pkg:gem/redis#lib/redis/commands/strings.rb:107
|
|
3182
|
+
def setex(key, ttl, value); end
|
|
3183
|
+
|
|
3184
|
+
# Set the value of a key, only if the key does not exist.
|
|
3185
|
+
#
|
|
3186
|
+
# @param [String] key
|
|
3187
|
+
# @param [String] value
|
|
3188
|
+
# @return [Boolean] whether the key was set or not
|
|
3189
|
+
#
|
|
3190
|
+
# pkg:gem/redis#lib/redis/commands/strings.rb:126
|
|
3191
|
+
def setnx(key, value); end
|
|
3192
|
+
|
|
3193
|
+
# Overwrite part of a string at key starting at the specified offset.
|
|
3194
|
+
#
|
|
3195
|
+
# @param [String] key
|
|
3196
|
+
# @param [Integer] offset byte offset
|
|
3197
|
+
# @param [String] value
|
|
3198
|
+
# @return [Integer] length of the string after it was modified
|
|
3199
|
+
#
|
|
3200
|
+
# pkg:gem/redis#lib/redis/commands/strings.rb:235
|
|
3201
|
+
def setrange(key, offset, value); end
|
|
3202
|
+
|
|
3203
|
+
# Get the length of the value stored in a key.
|
|
3204
|
+
#
|
|
3205
|
+
# @param [String] key
|
|
3206
|
+
# @return [Integer] the length of the value stored in the key, or 0
|
|
3207
|
+
# if the key does not exist
|
|
3208
|
+
#
|
|
3209
|
+
# pkg:gem/redis#lib/redis/commands/strings.rb:309
|
|
3210
|
+
def strlen(key); end
|
|
3211
|
+
end
|
|
3212
|
+
|
|
3213
|
+
# pkg:gem/redis#lib/redis/commands/transactions.rb:5
|
|
3214
|
+
module Redis::Commands::Transactions
|
|
3215
|
+
# Discard all commands issued after MULTI.
|
|
3216
|
+
#
|
|
3217
|
+
# @return [String] `"OK"`
|
|
3218
|
+
#
|
|
3219
|
+
# @see #multi
|
|
3220
|
+
# @see #exec
|
|
3221
|
+
#
|
|
3222
|
+
# pkg:gem/redis#lib/redis/commands/transactions.rb:110
|
|
3223
|
+
def discard; end
|
|
3224
|
+
|
|
3225
|
+
# Execute all commands issued after MULTI.
|
|
3226
|
+
#
|
|
3227
|
+
# Only call this method when `#multi` was called **without** a block.
|
|
3228
|
+
#
|
|
3229
|
+
# @return [nil, Array<...>]
|
|
3230
|
+
# - when commands were not executed, `nil`
|
|
3231
|
+
# - when commands were executed, an array with their replies
|
|
3232
|
+
#
|
|
3233
|
+
# @see #multi
|
|
3234
|
+
# @see #discard
|
|
3235
|
+
#
|
|
3236
|
+
# pkg:gem/redis#lib/redis/commands/transactions.rb:100
|
|
3237
|
+
def exec; end
|
|
3238
|
+
|
|
3239
|
+
# Mark the start of a transaction block.
|
|
3240
|
+
#
|
|
3241
|
+
# @example With a block
|
|
3242
|
+
# redis.multi do |multi|
|
|
3243
|
+
# multi.set("key", "value")
|
|
3244
|
+
# multi.incr("counter")
|
|
3245
|
+
# end # => ["OK", 6]
|
|
3246
|
+
#
|
|
3247
|
+
# @yield [multi] the commands that are called inside this block are cached
|
|
3248
|
+
# and written to the server upon returning from it
|
|
3249
|
+
# @yieldparam [Redis] multi `self`
|
|
3250
|
+
#
|
|
3251
|
+
# @return [Array<...>]
|
|
3252
|
+
# - an array with replies
|
|
3253
|
+
#
|
|
3254
|
+
# @see #watch
|
|
3255
|
+
# @see #unwatch
|
|
3256
|
+
#
|
|
3257
|
+
# pkg:gem/redis#lib/redis/commands/transactions.rb:23
|
|
3258
|
+
def multi; end
|
|
3259
|
+
|
|
3260
|
+
# Forget about all watched keys.
|
|
3261
|
+
#
|
|
3262
|
+
# @return [String] `OK`
|
|
3263
|
+
#
|
|
3264
|
+
# @see #watch
|
|
3265
|
+
# @see #multi
|
|
3266
|
+
#
|
|
3267
|
+
# pkg:gem/redis#lib/redis/commands/transactions.rb:86
|
|
3268
|
+
def unwatch; end
|
|
3269
|
+
|
|
3270
|
+
# Watch the given keys to determine execution of the MULTI/EXEC block.
|
|
3271
|
+
#
|
|
3272
|
+
# Using a block is optional, but is necessary for thread-safety.
|
|
3273
|
+
#
|
|
3274
|
+
# An `#unwatch` is automatically issued if an exception is raised within the
|
|
3275
|
+
# block that is a subclass of StandardError and is not a ConnectionError.
|
|
3276
|
+
#
|
|
3277
|
+
# @example With a block
|
|
3278
|
+
# redis.watch("key") do
|
|
3279
|
+
# if redis.get("key") == "some value"
|
|
3280
|
+
# redis.multi do |multi|
|
|
3281
|
+
# multi.set("key", "other value")
|
|
3282
|
+
# multi.incr("counter")
|
|
3283
|
+
# end
|
|
3284
|
+
# else
|
|
3285
|
+
# redis.unwatch
|
|
3286
|
+
# end
|
|
3287
|
+
# end
|
|
3288
|
+
# # => ["OK", 6]
|
|
3289
|
+
#
|
|
3290
|
+
# @example Without a block
|
|
3291
|
+
# redis.watch("key")
|
|
3292
|
+
# # => "OK"
|
|
3293
|
+
#
|
|
3294
|
+
# @param [String, Array<String>] keys one or more keys to watch
|
|
3295
|
+
# @return [Object] if using a block, returns the return value of the block
|
|
3296
|
+
# @return [String] if not using a block, returns `OK`
|
|
3297
|
+
#
|
|
3298
|
+
# @see #unwatch
|
|
3299
|
+
# @see #multi
|
|
3300
|
+
#
|
|
3301
|
+
# pkg:gem/redis#lib/redis/commands/transactions.rb:61
|
|
3302
|
+
def watch(*keys); end
|
|
3303
|
+
end
|
|
3304
|
+
|
|
3305
|
+
# soft-deprecated
|
|
3306
|
+
# We added this back for older sidekiq releases
|
|
3307
|
+
#
|
|
3308
|
+
# pkg:gem/redis#lib/redis.rb:29
|
|
3309
|
+
module Redis::Connection
|
|
3310
|
+
class << self
|
|
3311
|
+
# pkg:gem/redis#lib/redis.rb:31
|
|
3312
|
+
def drivers; end
|
|
3313
|
+
end
|
|
3314
|
+
end
|
|
3315
|
+
|
|
3316
|
+
# Raised when connection to a Redis server is lost.
|
|
3317
|
+
#
|
|
3318
|
+
# pkg:gem/redis#lib/redis/errors.rb:46
|
|
3319
|
+
class Redis::ConnectionError < ::Redis::BaseConnectionError; end
|
|
3320
|
+
|
|
3321
|
+
# pkg:gem/redis#lib/redis.rb:11
|
|
3322
|
+
class Redis::Deprecated < ::StandardError; end
|
|
3323
|
+
|
|
3324
|
+
# pkg:gem/redis#lib/redis/pipeline.rb:80
|
|
3325
|
+
class Redis::Future < ::BasicObject
|
|
3326
|
+
# pkg:gem/redis#lib/redis/pipeline.rb:83
|
|
3327
|
+
def initialize(command, coerce, exception); end
|
|
3328
|
+
|
|
3329
|
+
# pkg:gem/redis#lib/redis/pipeline.rb:94
|
|
3330
|
+
def _set(object); end
|
|
3331
|
+
|
|
3332
|
+
# pkg:gem/redis#lib/redis/pipeline.rb:108
|
|
3333
|
+
def class; end
|
|
3334
|
+
|
|
3335
|
+
# pkg:gem/redis#lib/redis/pipeline.rb:90
|
|
3336
|
+
def inspect; end
|
|
3337
|
+
|
|
3338
|
+
# pkg:gem/redis#lib/redis/pipeline.rb:104
|
|
3339
|
+
def is_a?(other); end
|
|
3340
|
+
|
|
3341
|
+
# pkg:gem/redis#lib/redis/pipeline.rb:99
|
|
3342
|
+
def value; end
|
|
3343
|
+
end
|
|
3344
|
+
|
|
3345
|
+
# pkg:gem/redis#lib/redis/pipeline.rb:81
|
|
3346
|
+
Redis::Future::FutureNotReady = T.let(T.unsafe(nil), Redis::FutureNotReady)
|
|
3347
|
+
|
|
3348
|
+
# pkg:gem/redis#lib/redis/pipeline.rb:74
|
|
3349
|
+
class Redis::FutureNotReady < ::RuntimeError
|
|
3350
|
+
# pkg:gem/redis#lib/redis/pipeline.rb:75
|
|
3351
|
+
def initialize; end
|
|
3352
|
+
end
|
|
3353
|
+
|
|
3354
|
+
# Raised when the connection was inherited by a child process.
|
|
3355
|
+
#
|
|
3356
|
+
# pkg:gem/redis#lib/redis/errors.rb:54
|
|
3357
|
+
class Redis::InheritedError < ::Redis::BaseConnectionError; end
|
|
3358
|
+
|
|
3359
|
+
# Raised when client options are invalid.
|
|
3360
|
+
#
|
|
3361
|
+
# pkg:gem/redis#lib/redis/errors.rb:62
|
|
3362
|
+
class Redis::InvalidClientOptionError < ::Redis::BaseError; end
|
|
3363
|
+
|
|
3364
|
+
# pkg:gem/redis#lib/redis/pipeline.rb:59
|
|
3365
|
+
class Redis::MultiConnection < ::Redis::PipelinedConnection
|
|
3366
|
+
# pkg:gem/redis#lib/redis/pipeline.rb:60
|
|
3367
|
+
def multi; end
|
|
3368
|
+
|
|
3369
|
+
private
|
|
3370
|
+
|
|
3371
|
+
# Blocking commands inside transaction behave like non-blocking.
|
|
3372
|
+
# It shouldn't be done though.
|
|
3373
|
+
# https://redis.io/commands/blpop/#blpop-inside-a-multi--exec-transaction
|
|
3374
|
+
#
|
|
3375
|
+
# pkg:gem/redis#lib/redis/pipeline.rb:69
|
|
3376
|
+
def send_blocking_command(command, _timeout, &block); end
|
|
3377
|
+
end
|
|
3378
|
+
|
|
3379
|
+
# pkg:gem/redis#lib/redis/pipeline.rb:113
|
|
3380
|
+
class Redis::MultiFuture < ::Redis::Future
|
|
3381
|
+
# pkg:gem/redis#lib/redis/pipeline.rb:114
|
|
3382
|
+
def initialize(futures); end
|
|
3383
|
+
|
|
3384
|
+
# pkg:gem/redis#lib/redis/pipeline.rb:120
|
|
3385
|
+
def _set(replies); end
|
|
3386
|
+
end
|
|
3387
|
+
|
|
3388
|
+
# pkg:gem/redis#lib/redis/errors.rb:33
|
|
3389
|
+
class Redis::NoScriptError < ::Redis::CommandError; end
|
|
3390
|
+
|
|
3391
|
+
# pkg:gem/redis#lib/redis/errors.rb:29
|
|
3392
|
+
class Redis::OutOfMemoryError < ::Redis::CommandError; end
|
|
3393
|
+
|
|
3394
|
+
# pkg:gem/redis#lib/redis/errors.rb:23
|
|
3395
|
+
class Redis::PermissionError < ::Redis::CommandError; end
|
|
3396
|
+
|
|
3397
|
+
# pkg:gem/redis#lib/redis/pipeline.rb:6
|
|
3398
|
+
class Redis::PipelinedConnection
|
|
3399
|
+
include ::Redis::Commands::Bitmaps
|
|
3400
|
+
include ::Redis::Commands::Cluster
|
|
3401
|
+
include ::Redis::Commands::Connection
|
|
3402
|
+
include ::Redis::Commands::Geo
|
|
3403
|
+
include ::Redis::Commands::Hashes
|
|
3404
|
+
include ::Redis::Commands::HyperLogLog
|
|
3405
|
+
include ::Redis::Commands::Keys
|
|
3406
|
+
include ::Redis::Commands::Lists
|
|
3407
|
+
include ::Redis::Commands::Pubsub
|
|
3408
|
+
include ::Redis::Commands::Scripting
|
|
3409
|
+
include ::Redis::Commands::Server
|
|
3410
|
+
include ::Redis::Commands::Sets
|
|
3411
|
+
include ::Redis::Commands::SortedSets
|
|
3412
|
+
include ::Redis::Commands::Streams
|
|
3413
|
+
include ::Redis::Commands::Strings
|
|
3414
|
+
include ::Redis::Commands::Transactions
|
|
3415
|
+
include ::Redis::Commands
|
|
3416
|
+
|
|
3417
|
+
# pkg:gem/redis#lib/redis/pipeline.rb:9
|
|
3418
|
+
def initialize(pipeline, futures = T.unsafe(nil), exception: T.unsafe(nil)); end
|
|
3419
|
+
|
|
3420
|
+
# pkg:gem/redis#lib/redis/pipeline.rb:7
|
|
3421
|
+
def db; end
|
|
3422
|
+
|
|
3423
|
+
# pkg:gem/redis#lib/redis/pipeline.rb:7
|
|
3424
|
+
def db=(_arg0); end
|
|
3425
|
+
|
|
3426
|
+
# pkg:gem/redis#lib/redis/pipeline.rb:21
|
|
3427
|
+
def multi; end
|
|
3428
|
+
|
|
3429
|
+
# pkg:gem/redis#lib/redis/pipeline.rb:17
|
|
3430
|
+
def pipelined; end
|
|
3431
|
+
|
|
3432
|
+
private
|
|
3433
|
+
|
|
3434
|
+
# pkg:gem/redis#lib/redis/pipeline.rb:49
|
|
3435
|
+
def send_blocking_command(command, timeout, &block); end
|
|
3436
|
+
|
|
3437
|
+
# pkg:gem/redis#lib/redis/pipeline.rb:40
|
|
3438
|
+
def send_command(command, &block); end
|
|
3439
|
+
|
|
3440
|
+
# pkg:gem/redis#lib/redis/pipeline.rb:36
|
|
3441
|
+
def synchronize; end
|
|
3442
|
+
end
|
|
3443
|
+
|
|
3444
|
+
# Raised by the connection when a protocol error occurs.
|
|
3445
|
+
#
|
|
3446
|
+
# pkg:gem/redis#lib/redis/errors.rb:9
|
|
3447
|
+
class Redis::ProtocolError < ::Redis::BaseError
|
|
3448
|
+
# pkg:gem/redis#lib/redis/errors.rb:10
|
|
3449
|
+
def initialize(reply_type); end
|
|
3450
|
+
end
|
|
3451
|
+
|
|
3452
|
+
# Generally raised during Redis failover scenarios
|
|
3453
|
+
#
|
|
3454
|
+
# pkg:gem/redis#lib/redis/errors.rb:58
|
|
3455
|
+
class Redis::ReadOnlyError < ::Redis::BaseConnectionError; end
|
|
3456
|
+
|
|
3457
|
+
# pkg:gem/redis#lib/redis.rb:39
|
|
3458
|
+
Redis::SERVER_URL_OPTIONS = T.let(T.unsafe(nil), Array)
|
|
3459
|
+
|
|
3460
|
+
# pkg:gem/redis#lib/redis/subscribe.rb:4
|
|
3461
|
+
class Redis::SubscribedClient
|
|
3462
|
+
# pkg:gem/redis#lib/redis/subscribe.rb:5
|
|
3463
|
+
def initialize(client); end
|
|
3464
|
+
|
|
3465
|
+
# pkg:gem/redis#lib/redis/subscribe.rb:10
|
|
3466
|
+
def call_v(command); end
|
|
3467
|
+
|
|
3468
|
+
# pkg:gem/redis#lib/redis/subscribe.rb:52
|
|
3469
|
+
def close; end
|
|
3470
|
+
|
|
3471
|
+
# pkg:gem/redis#lib/redis/subscribe.rb:24
|
|
3472
|
+
def psubscribe(*channels, &block); end
|
|
3473
|
+
|
|
3474
|
+
# pkg:gem/redis#lib/redis/subscribe.rb:28
|
|
3475
|
+
def psubscribe_with_timeout(timeout, *channels, &block); end
|
|
3476
|
+
|
|
3477
|
+
# pkg:gem/redis#lib/redis/subscribe.rb:44
|
|
3478
|
+
def punsubscribe(*channels); end
|
|
3479
|
+
|
|
3480
|
+
# pkg:gem/redis#lib/redis/subscribe.rb:32
|
|
3481
|
+
def ssubscribe(*channels, &block); end
|
|
3482
|
+
|
|
3483
|
+
# pkg:gem/redis#lib/redis/subscribe.rb:36
|
|
3484
|
+
def ssubscribe_with_timeout(timeout, *channels, &block); end
|
|
3485
|
+
|
|
3486
|
+
# pkg:gem/redis#lib/redis/subscribe.rb:16
|
|
3487
|
+
def subscribe(*channels, &block); end
|
|
3488
|
+
|
|
3489
|
+
# pkg:gem/redis#lib/redis/subscribe.rb:20
|
|
3490
|
+
def subscribe_with_timeout(timeout, *channels, &block); end
|
|
3491
|
+
|
|
3492
|
+
# pkg:gem/redis#lib/redis/subscribe.rb:48
|
|
3493
|
+
def sunsubscribe(*channels); end
|
|
3494
|
+
|
|
3495
|
+
# pkg:gem/redis#lib/redis/subscribe.rb:40
|
|
3496
|
+
def unsubscribe(*channels); end
|
|
3497
|
+
|
|
3498
|
+
protected
|
|
3499
|
+
|
|
3500
|
+
# pkg:gem/redis#lib/redis/subscribe.rb:58
|
|
3501
|
+
def subscription(start, stop, channels, block, timeout = T.unsafe(nil)); end
|
|
3502
|
+
end
|
|
3503
|
+
|
|
3504
|
+
# pkg:gem/redis#lib/redis/subscribe.rb:82
|
|
3505
|
+
class Redis::Subscription
|
|
3506
|
+
# pkg:gem/redis#lib/redis/subscribe.rb:85
|
|
3507
|
+
def initialize; end
|
|
3508
|
+
|
|
3509
|
+
# pkg:gem/redis#lib/redis/subscribe.rb:83
|
|
3510
|
+
def callbacks; end
|
|
3511
|
+
|
|
3512
|
+
# pkg:gem/redis#lib/redis/subscribe.rb:98
|
|
3513
|
+
def message(&block); end
|
|
3514
|
+
|
|
3515
|
+
# pkg:gem/redis#lib/redis/subscribe.rb:110
|
|
3516
|
+
def pmessage(&block); end
|
|
3517
|
+
|
|
3518
|
+
# pkg:gem/redis#lib/redis/subscribe.rb:102
|
|
3519
|
+
def psubscribe(&block); end
|
|
3520
|
+
|
|
3521
|
+
# pkg:gem/redis#lib/redis/subscribe.rb:106
|
|
3522
|
+
def punsubscribe(&block); end
|
|
3523
|
+
|
|
3524
|
+
# pkg:gem/redis#lib/redis/subscribe.rb:122
|
|
3525
|
+
def smessage(&block); end
|
|
3526
|
+
|
|
3527
|
+
# pkg:gem/redis#lib/redis/subscribe.rb:114
|
|
3528
|
+
def ssubscribe(&block); end
|
|
3529
|
+
|
|
3530
|
+
# pkg:gem/redis#lib/redis/subscribe.rb:90
|
|
3531
|
+
def subscribe(&block); end
|
|
3532
|
+
|
|
3533
|
+
# pkg:gem/redis#lib/redis/subscribe.rb:118
|
|
3534
|
+
def sunsubscribe(&block); end
|
|
3535
|
+
|
|
3536
|
+
# pkg:gem/redis#lib/redis/subscribe.rb:94
|
|
3537
|
+
def unsubscribe(&block); end
|
|
3538
|
+
end
|
|
3539
|
+
|
|
3540
|
+
# pkg:gem/redis#lib/redis/errors.rb:65
|
|
3541
|
+
class Redis::SubscriptionError < ::Redis::BaseError; end
|
|
3542
|
+
|
|
3543
|
+
# Raised when performing I/O times out.
|
|
3544
|
+
#
|
|
3545
|
+
# pkg:gem/redis#lib/redis/errors.rb:50
|
|
3546
|
+
class Redis::TimeoutError < ::Redis::BaseConnectionError; end
|
|
3547
|
+
|
|
3548
|
+
# pkg:gem/redis#lib/redis/version.rb:4
|
|
3549
|
+
Redis::VERSION = T.let(T.unsafe(nil), String)
|
|
3550
|
+
|
|
3551
|
+
# pkg:gem/redis#lib/redis/errors.rb:26
|
|
3552
|
+
class Redis::WrongTypeError < ::Redis::CommandError; end
|