redis 4.1.1 → 4.1.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: fba6921160b00d34cc11548defceaaee4fc9c181
4
- data.tar.gz: e5eac2ace205355e4890084cc96fe98c651e8d30
2
+ SHA256:
3
+ metadata.gz: 83f1f7270db68603d63e86ec43e68348cb5ccb2b4e6759642d89898566bdbaf6
4
+ data.tar.gz: 45c5bcc92629ec7d85cdc2b913e7922cd5425f2e6691891efc379aeec73026b3
5
5
  SHA512:
6
- metadata.gz: 5e88bba869f876bc046935479283f108b46107ab00e7ab60487ca524977635dbdc9b0dcfd037a9b057e43765975c26cdc3a0ceea95aefacf608041a18b50f14e
7
- data.tar.gz: 91360e891b269c8ecb962414f29d023ace19af98e929d7f7680590dcb8520a87deb6c2a47ba27da0ea16eb47ee90d4c8bdf2be894a40c00820f9c07479188cc2
6
+ metadata.gz: 692dfc5c73c6410492589f38f279976a023f6a2ff13f7b1476806011eb387f41bed784bdeac746de5f4b990b6d22bf297b36dddc7b8e448a842241a389f50796
7
+ data.tar.gz: 55a9e305c7563f5dd7d38f50dc7b919967dbb0f6a131ebc5e1569f49f196ab458203b6594394fa9a33ea9e337b741113e781378113783683dd36b87196607b8f
data/CHANGELOG.md CHANGED
@@ -1,5 +1,35 @@
1
1
  # Unreleased
2
2
 
3
+ # 4.1.4
4
+
5
+ * Alias `Redis#disconnect` as `#close`. See #901.
6
+ * Handle clusters with multiple slot ranges. See #894.
7
+ * Fix password authentication to a redis cluster. See #889.
8
+ * Handle recursive MOVED responses. See #882.
9
+ * Increase buffer size in the ruby connector. See #880.
10
+ * Fix thread safety of `Redis.queue`. See #878.
11
+ * Deprecate `Redis::Future#==` as it's likely to be a mistake. See #876.
12
+
13
+ # 4.1.3
14
+
15
+ * Fix the client hanging forever when connecting with SSL to a non-SSL server. See #835.
16
+
17
+ # 4.1.2
18
+
19
+ * Fix several authentication problems with sentinel. See #850 and #856.
20
+ * Explicitly drop Ruby 2.2 support.
21
+
22
+
23
+ # 4.1.1
24
+
25
+ * Fix error handling in multi blocks. See #754.
26
+ * Fix geoadd to accept arrays like georadius and georadiusbymember. See #841.
27
+ * Fix georadius command failing when long == lat. See #841.
28
+ * Fix timeout error in xread block: 0. See #837.
29
+ * Fix incompatibility issue with redis-objects. See #834.
30
+ * Properly handle Errno::EADDRNOTAVAIL on connect.
31
+ * Fix password authentication to sentinel instances. See #813.
32
+
3
33
  # 4.1.0
4
34
 
5
35
  * Add Redis Cluster support. See #716.
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # redis-rb [![Build Status][travis-image]][travis-link] [![Inline docs][inchpages-image]][inchpages-link]
1
+ # redis-rb [![Build Status][travis-image]][travis-link] [![Inline docs][inchpages-image]][inchpages-link] ![](https://github.com/redis/redis-rb/workflows/Test/badge.svg?branch=master)
2
2
 
3
3
  A Ruby client that tries to match [Redis][redis-home]' API one-to-one, while still
4
4
  providing an idiomatic interface.
@@ -95,6 +95,15 @@ but a few so that if one is down the client will try the next one. The client
95
95
  is able to remember the last Sentinel that was able to reply correctly and will
96
96
  use it for the next requests.
97
97
 
98
+ If you want to [authenticate](https://redis.io/topics/sentinel#configuring-sentinel-instances-with-authentication) Sentinel itself, you must specify the `password` option per instance.
99
+
100
+ ```ruby
101
+ SENTINELS = [{ host: '127.0.0.1', port: 26380, password: 'mysecret' },
102
+ { host: '127.0.0.1', port: 26381, password: 'mysecret' }]
103
+
104
+ redis = Redis.new(host: 'mymaster', sentinels: SENTINELS, role: :master)
105
+ ```
106
+
98
107
  ## Cluster support
99
108
 
100
109
  `redis-rb` supports [clustering](https://redis.io/topics/cluster-spec).
@@ -133,6 +142,7 @@ redis.mget('{key}1', '{key}2')
133
142
  ```
134
143
 
135
144
  * The client automatically reconnects after a failover occurred, but the caller is responsible for handling errors while it is happening.
145
+ * The client support permanent node failures, and will reroute requests to promoted slaves.
136
146
  * The client supports `MOVED` and `ASK` redirections transparently.
137
147
 
138
148
  ## Storing objects
@@ -427,6 +437,10 @@ redis = Redis.new(:driver => :synchrony)
427
437
  This library is tested against recent Ruby and Redis versions.
428
438
  Check [Travis][travis-link] for the exact versions supported.
429
439
 
440
+ ## See Also
441
+
442
+ - [async-redis](https://github.com/socketry/async-redis) — An [async](https://github.com/socketry/async) compatible Redis client.
443
+
430
444
  ## Contributors
431
445
 
432
446
  Several people contributed to redis-rb, but we would like to especially
data/lib/redis/client.rb CHANGED
@@ -250,6 +250,7 @@ class Redis
250
250
  def disconnect
251
251
  connection.disconnect if connected?
252
252
  end
253
+ alias_method :close, :disconnect
253
254
 
254
255
  def reconnect
255
256
  disconnect
@@ -577,6 +578,7 @@ class Redis
577
578
  client = Client.new(@options.merge({
578
579
  :host => sentinel[:host],
579
580
  :port => sentinel[:port],
581
+ password: sentinel[:password],
580
582
  :reconnect_attempts => 0,
581
583
  }))
582
584
 
@@ -595,11 +597,6 @@ class Redis
595
597
  end
596
598
 
597
599
  raise CannotConnectError, "No sentinels available."
598
- rescue Redis::CommandError => err
599
- # this feature is only available starting with Redis 5.0.1
600
- raise unless err.message.start_with?('ERR unknown command `auth`')
601
- @options[:password] = DEFAULTS.fetch(:password)
602
- retry
603
600
  end
604
601
 
605
602
  def resolve_master
@@ -6,17 +6,13 @@ class Redis
6
6
  # It is different from node id.
7
7
  # Node id is internal identifying code in Redis Cluster.
8
8
  module NodeKey
9
- DEFAULT_SCHEME = 'redis'
10
- SECURE_SCHEME = 'rediss'
11
9
  DELIMITER = ':'
12
10
 
13
11
  module_function
14
12
 
15
- def to_node_urls(node_keys, secure:)
16
- scheme = secure ? SECURE_SCHEME : DEFAULT_SCHEME
17
- node_keys
18
- .map { |k| k.split(DELIMITER) }
19
- .map { |k| URI::Generic.build(scheme: scheme, host: k[0], port: k[1].to_i).to_s }
13
+ def optionize(node_key)
14
+ host, port = split(node_key)
15
+ { host: host, port: port }
20
16
  end
21
17
 
22
18
  def split(node_key)
@@ -15,35 +15,33 @@ class Redis
15
15
  def initialize(options)
16
16
  options = options.dup
17
17
  node_addrs = options.delete(:cluster)
18
- @node_uris = build_node_uris(node_addrs)
18
+ @node_opts = build_node_options(node_addrs)
19
19
  @replica = options.delete(:replica) == true
20
+ add_common_node_option_if_needed(options, @node_opts, :scheme)
21
+ add_common_node_option_if_needed(options, @node_opts, :password)
20
22
  @options = options
21
23
  end
22
24
 
23
25
  def per_node_key
24
- @node_uris.map { |uri| [NodeKey.build_from_uri(uri), @options.merge(url: uri.to_s)] }
26
+ @node_opts.map { |opt| [NodeKey.build_from_host_port(opt[:host], opt[:port]), @options.merge(opt)] }
25
27
  .to_h
26
28
  end
27
29
 
28
- def secure?
29
- @node_uris.any? { |uri| uri.scheme == SECURE_SCHEME } || @options[:ssl_params] || false
30
- end
31
-
32
30
  def use_replica?
33
31
  @replica
34
32
  end
35
33
 
36
34
  def update_node(addrs)
37
- @node_uris = build_node_uris(addrs)
35
+ @node_opts = build_node_options(addrs)
38
36
  end
39
37
 
40
38
  def add_node(host, port)
41
- @node_uris << parse_node_hash(host: host, port: port)
39
+ @node_opts << { host: host, port: port }
42
40
  end
43
41
 
44
42
  private
45
43
 
46
- def build_node_uris(addrs)
44
+ def build_node_options(addrs)
47
45
  raise InvalidClientOptionError, 'Redis option of `cluster` must be an Array' unless addrs.is_a?(Array)
48
46
  addrs.map { |addr| parse_node_addr(addr) }
49
47
  end
@@ -53,7 +51,7 @@ class Redis
53
51
  when String
54
52
  parse_node_url(addr)
55
53
  when Hash
56
- parse_node_hash(addr)
54
+ parse_node_option(addr)
57
55
  else
58
56
  raise InvalidClientOptionError, 'Redis option of `cluster` must includes String or Hash'
59
57
  end
@@ -62,15 +60,27 @@ class Redis
62
60
  def parse_node_url(addr)
63
61
  uri = URI(addr)
64
62
  raise InvalidClientOptionError, "Invalid uri scheme #{addr}" unless VALID_SCHEMES.include?(uri.scheme)
65
- uri
63
+
64
+ db = uri.path.split('/')[1]&.to_i
65
+ { scheme: uri.scheme, password: uri.password, host: uri.host, port: uri.port, db: db }.reject { |_, v| v.nil? }
66
66
  rescue URI::InvalidURIError => err
67
67
  raise InvalidClientOptionError, err.message
68
68
  end
69
69
 
70
- def parse_node_hash(addr)
70
+ def parse_node_option(addr)
71
71
  addr = addr.map { |k, v| [k.to_sym, v] }.to_h
72
72
  raise InvalidClientOptionError, 'Redis option of `cluster` must includes `:host` and `:port` keys' if addr.values_at(:host, :port).any?(&:nil?)
73
- URI::Generic.build(scheme: DEFAULT_SCHEME, host: addr[:host], port: addr[:port].to_i)
73
+
74
+ addr
75
+ end
76
+
77
+ # Redis cluster node returns only host and port information.
78
+ # So we should complement additional information such as:
79
+ # scheme, password and so on.
80
+ def add_common_node_option_if_needed(options, node_opts, key)
81
+ return options if options[key].nil? && node_opts.first[key].nil?
82
+
83
+ options[key] ||= node_opts.first[key]
74
84
  end
75
85
  end
76
86
  end
@@ -50,9 +50,12 @@ class Redis
50
50
  @node_flags[node_key] == ROLE_SLAVE
51
51
  end
52
52
 
53
+ # available_slots is mapping of node_key to list of slot ranges
53
54
  def build_slot_node_key_map(available_slots)
54
- available_slots.each_with_object({}) do |(node_key, slots), acc|
55
- slots.each { |slot| assign_node_key(acc, slot, node_key) }
55
+ available_slots.each_with_object({}) do |(node_key, slots_arr), acc|
56
+ slots_arr.each do |slots|
57
+ slots.each { |slot| assign_node_key(acc, slot, node_key) }
58
+ end
56
59
  end
57
60
  end
58
61
 
@@ -13,7 +13,7 @@ class Redis
13
13
  info = {}
14
14
 
15
15
  nodes.each do |node|
16
- info = Hash[*fetch_slot_info(node)]
16
+ info = fetch_slot_info(node)
17
17
  info.empty? ? next : break
18
18
  end
19
19
 
@@ -23,9 +23,11 @@ class Redis
23
23
  end
24
24
 
25
25
  def fetch_slot_info(node)
26
+ hash_with_default_arr = Hash.new { |h, k| h[k] = [] }
26
27
  node.call(%i[cluster slots])
27
- .map { |arr| parse_slot_info(arr, default_ip: node.host) }
28
- .flatten
28
+ .flat_map { |arr| parse_slot_info(arr, default_ip: node.host) }
29
+ .each_with_object(hash_with_default_arr) { |arr, h| h[arr[0]] << arr[1] }
30
+
29
31
  rescue CannotConnectError, ConnectionError, CommandError
30
32
  {} # can retry on another node
31
33
  end
@@ -34,7 +36,6 @@ class Redis
34
36
  first_slot, last_slot = arr[0..1]
35
37
  slot_range = (first_slot..last_slot).freeze
36
38
  arr[2..-1].map { |addr| [stringify_node_key(addr, default_ip), slot_range] }
37
- .flatten
38
39
  end
39
40
 
40
41
  def stringify_node_key(arr, default_ip)
data/lib/redis/cluster.rb CHANGED
@@ -112,12 +112,11 @@ class Redis
112
112
  node = Node.new(option.per_node_key)
113
113
  available_slots = SlotLoader.load(node)
114
114
  node_flags = NodeLoader.load_flags(node)
115
- available_node_urls = NodeKey.to_node_urls(available_slots.keys, secure: option.secure?)
116
- option.update_node(available_node_urls)
115
+ option.update_node(available_slots.keys.map { |k| NodeKey.optionize(k) })
117
116
  [Node.new(option.per_node_key, node_flags, option.use_replica?),
118
117
  Slot.new(available_slots, node_flags, option.use_replica?)]
119
118
  ensure
120
- node.map(&:disconnect)
119
+ node&.each(&:disconnect)
121
120
  end
122
121
 
123
122
  def fetch_command_details(nodes)
@@ -216,7 +215,10 @@ class Redis
216
215
  node.public_send(method_name, *args, &block)
217
216
  rescue CommandError => err
218
217
  if err.message.start_with?('MOVED')
219
- assign_redirection_node(err.message).public_send(method_name, *args, &block)
218
+ raise if retry_count <= 0
219
+ node = assign_redirection_node(err.message)
220
+ retry_count -= 1
221
+ retry
220
222
  elsif err.message.start_with?('ASK')
221
223
  raise if retry_count <= 0
222
224
  node = assign_asking_node(err.message)
@@ -226,6 +228,9 @@ class Redis
226
228
  else
227
229
  raise
228
230
  end
231
+ rescue CannotConnectError
232
+ update_cluster_info!
233
+ raise
229
234
  end
230
235
 
231
236
  def assign_redirection_node(err_msg)
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  class Redis
2
3
  module Connection
3
4
  module CommandHelper
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require_relative "registry"
2
3
  require_relative "../errors"
3
4
  require "hiredis/connection"
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  class Redis
2
3
  module Connection
3
4
 
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require_relative "registry"
2
3
  require_relative "command_helper"
3
4
  require_relative "../errors"
@@ -53,7 +54,7 @@ class Redis
53
54
  crlf = nil
54
55
 
55
56
  while (crlf = @buffer.index(CRLF)) == nil
56
- @buffer << _read_from_socket(1024)
57
+ @buffer << _read_from_socket(16384)
57
58
  end
58
59
 
59
60
  @buffer.slice!(0, crlf + CRLF.bytesize)
@@ -266,9 +267,30 @@ class Redis
266
267
 
267
268
  ssl_sock = new(tcp_sock, ctx)
268
269
  ssl_sock.hostname = host
269
- ssl_sock.connect
270
270
 
271
- unless ctx.verify_mode == OpenSSL::SSL::VERIFY_NONE
271
+ begin
272
+ # Initiate the socket connection in the background. If it doesn't fail
273
+ # immediately it will raise an IO::WaitWritable (Errno::EINPROGRESS)
274
+ # indicating the connection is in progress.
275
+ # Unlike waiting for a tcp socket to connect, you can't time out ssl socket
276
+ # connections during the connect phase properly, because IO.select only partially works.
277
+ # Instead, you have to retry.
278
+ ssl_sock.connect_nonblock
279
+ rescue Errno::EAGAIN, Errno::EWOULDBLOCK, IO::WaitReadable
280
+ if IO.select([ssl_sock], nil, nil, timeout)
281
+ retry
282
+ else
283
+ raise TimeoutError
284
+ end
285
+ rescue IO::WaitWritable
286
+ if IO.select(nil, [ssl_sock], nil, timeout)
287
+ retry
288
+ else
289
+ raise TimeoutError
290
+ end
291
+ end
292
+
293
+ unless ctx.verify_mode == OpenSSL::SSL::VERIFY_NONE || (ctx.respond_to?(:verify_hostname) && !ctx.verify_hostname)
272
294
  ssl_sock.post_connection_check(host)
273
295
  end
274
296
 
@@ -300,6 +322,7 @@ class Redis
300
322
  instance.timeout = config[:read_timeout]
301
323
  instance.write_timeout = config[:write_timeout]
302
324
  instance.set_tcp_keepalive config[:tcp_keepalive]
325
+ instance.set_tcp_nodelay if sock.is_a? TCPSocket
303
326
  instance
304
327
  end
305
328
 
@@ -330,6 +353,16 @@ class Redis
330
353
  end
331
354
  end
332
355
 
356
+ # disables Nagle's Algorithm, prevents multiple round trips with MULTI
357
+ if [:IPPROTO_TCP, :TCP_NODELAY].all?{|c| Socket.const_defined? c}
358
+ def set_tcp_nodelay
359
+ @sock.setsockopt(Socket::IPPROTO_TCP, Socket::TCP_NODELAY, 1)
360
+ end
361
+ else
362
+ def set_tcp_nodelay
363
+ end
364
+ end
365
+
333
366
  def initialize(sock)
334
367
  @sock = sock
335
368
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require_relative "command_helper"
2
3
  require_relative "registry"
3
4
  require_relative "../errors"
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require_relative "connection/registry"
2
3
 
3
4
  # If a connection driver was required before this file, the array
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require_relative "hash_ring"
2
3
 
3
4
  class Redis
@@ -401,13 +402,12 @@ class Redis
401
402
  end
402
403
 
403
404
  def _bpop(cmd, args)
404
- options = {}
405
-
406
- if args.last.is_a?(Hash)
405
+ timeout = if args.last.is_a?(Hash)
407
406
  options = args.pop
407
+ options[:timeout]
408
408
  elsif args.last.respond_to?(:to_int)
409
409
  # Issue deprecation notice in obnoxious mode...
410
- options[:timeout] = args.pop.to_int
410
+ args.pop.to_int
411
411
  end
412
412
 
413
413
  if args.size > 1
@@ -417,7 +417,11 @@ class Redis
417
417
  keys = args.flatten
418
418
 
419
419
  ensure_same_node(cmd, keys) do |node|
420
- node.__send__(cmd, keys, options)
420
+ if timeout
421
+ node.__send__(cmd, keys, timeout: timeout)
422
+ else
423
+ node.__send__(cmd, keys)
424
+ end
421
425
  end
422
426
  end
423
427
 
data/lib/redis/errors.rb CHANGED
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  class Redis
2
3
  # Base error for all redis-rb errors.
3
4
  class BaseError < RuntimeError
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'zlib'
2
3
 
3
4
  class Redis
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  class Redis
2
3
  class Pipeline
3
4
  attr_accessor :db
@@ -139,6 +140,20 @@ class Redis
139
140
  @object = FutureNotReady
140
141
  end
141
142
 
143
+ def ==(_other)
144
+ message = +"The methods == and != are deprecated for Redis::Future and will be removed in 4.2.0"
145
+ message << " - You probably meant to call .value == or .value !="
146
+ message << " (#{::Kernel.caller(1, 1).first})\n"
147
+
148
+ if defined?(::Warning)
149
+ ::Warning.warn(message)
150
+ else
151
+ $stderr.puts(message)
152
+ end
153
+
154
+ super
155
+ end
156
+
142
157
  def inspect
143
158
  "<Redis::Future #{@command.inspect}>"
144
159
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  class Redis
2
3
  class SubscribedClient
3
4
  def initialize(client)
data/lib/redis/version.rb CHANGED
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  class Redis
2
- VERSION = '4.1.1'
3
+ VERSION = '4.1.4'
3
4
  end
data/lib/redis.rb CHANGED
@@ -4,7 +4,6 @@ require "monitor"
4
4
  require_relative "redis/errors"
5
5
 
6
6
  class Redis
7
-
8
7
  def self.current
9
8
  @current ||= Redis.new
10
9
  end
@@ -20,16 +19,16 @@ class Redis
20
19
  # @param [Hash] options
21
20
  # @option options [String] :url (value of the environment variable REDIS_URL) a Redis URL, for a TCP connection: `redis://:[password]@[hostname]:[port]/[db]` (password, port and database are optional), for a unix socket connection: `unix://[path to Redis socket]`. This overrides all other options.
22
21
  # @option options [String] :host ("127.0.0.1") server hostname
23
- # @option options [Fixnum] :port (6379) server port
22
+ # @option options [Integer] :port (6379) server port
24
23
  # @option options [String] :path path to server socket (overrides host and port)
25
24
  # @option options [Float] :timeout (5.0) timeout in seconds
26
25
  # @option options [Float] :connect_timeout (same as timeout) timeout for initial connect in seconds
27
26
  # @option options [String] :password Password to authenticate against server
28
- # @option options [Fixnum] :db (0) Database to select after initial connect
27
+ # @option options [Integer] :db (0) Database to select after initial connect
29
28
  # @option options [Symbol] :driver Driver to use, currently supported: `:ruby`, `:hiredis`, `:synchrony`
30
29
  # @option options [String] :id ID for the client connection, assigns name to current connection by sending `CLIENT SETNAME`
31
- # @option options [Hash, Fixnum] :tcp_keepalive Keepalive values, if Fixnum `intvl` and `probe` are calculated based on the value, if Hash `time`, `intvl` and `probes` can be specified as a Fixnum
32
- # @option options [Fixnum] :reconnect_attempts Number of attempts trying to connect
30
+ # @option options [Hash, Integer] :tcp_keepalive Keepalive values, if Integer `intvl` and `probe` are calculated based on the value, if Hash `time`, `intvl` and `probes` can be specified as a Integer
31
+ # @option options [Integer] :reconnect_attempts Number of attempts trying to connect
33
32
  # @option options [Boolean] :inherit_socket (false) Whether to use socket in forked process or not
34
33
  # @option options [Array] :sentinels List of sentinels to contact
35
34
  # @option options [Symbol] :role (:master) Role to fetch via Sentinel, either `:master` or `:slave`
@@ -96,7 +95,9 @@ class Redis
96
95
  # See http://redis.io/topics/pipelining for more details.
97
96
  #
98
97
  def queue(*command)
99
- @queue[Thread.current.object_id] << command
98
+ synchronize do
99
+ @queue[Thread.current.object_id] << command
100
+ end
100
101
  end
101
102
 
102
103
  # Sends all commands in the queue.
@@ -135,7 +136,7 @@ class Redis
135
136
 
136
137
  # Change the selected database for the current connection.
137
138
  #
138
- # @param [Fixnum] db zero-based index of the DB to use (0 to 15)
139
+ # @param [Integer] db zero-based index of the DB to use (0 to 15)
139
140
  # @return [String] `OK`
140
141
  def select(db)
141
142
  synchronize do |client|
@@ -234,7 +235,7 @@ class Redis
234
235
 
235
236
  # Return the number of keys in the selected database.
236
237
  #
237
- # @return [Fixnum]
238
+ # @return [Integer]
238
239
  def dbsize
239
240
  synchronize do |client|
240
241
  client.call([:dbsize])
@@ -303,7 +304,7 @@ class Redis
303
304
 
304
305
  # Get the UNIX time stamp of the last successful save to disk.
305
306
  #
306
- # @return [Fixnum]
307
+ # @return [Integer]
307
308
  def lastsave
308
309
  synchronize do |client|
309
310
  client.call([:lastsave])
@@ -355,8 +356,8 @@ class Redis
355
356
  # Interact with the slowlog (get, len, reset)
356
357
  #
357
358
  # @param [String] subcommand e.g. `get`, `len`, `reset`
358
- # @param [Fixnum] length maximum number of entries to return
359
- # @return [Array<String>, Fixnum, String] depends on subcommand
359
+ # @param [Integer] length maximum number of entries to return
360
+ # @return [Array<String>, Integer, String] depends on subcommand
360
361
  def slowlog(subcommand, length=nil)
361
362
  synchronize do |client|
362
363
  args = [:slowlog, subcommand]
@@ -377,7 +378,7 @@ class Redis
377
378
  # @example
378
379
  # r.time # => [ 1333093196, 606806 ]
379
380
  #
380
- # @return [Array<Fixnum>] tuple of seconds since UNIX epoch and
381
+ # @return [Array<Integer>] tuple of seconds since UNIX epoch and
381
382
  # microseconds in the current second
382
383
  def time
383
384
  synchronize do |client|
@@ -400,7 +401,7 @@ class Redis
400
401
  # Set a key's time to live in seconds.
401
402
  #
402
403
  # @param [String] key
403
- # @param [Fixnum] seconds time to live
404
+ # @param [Integer] seconds time to live
404
405
  # @return [Boolean] whether the timeout was set or not
405
406
  def expire(key, seconds)
406
407
  synchronize do |client|
@@ -411,7 +412,7 @@ class Redis
411
412
  # Set the expiration for a key as a UNIX timestamp.
412
413
  #
413
414
  # @param [String] key
414
- # @param [Fixnum] unix_time expiry time specified as a UNIX timestamp
415
+ # @param [Integer] unix_time expiry time specified as a UNIX timestamp
415
416
  # @return [Boolean] whether the timeout was set or not
416
417
  def expireat(key, unix_time)
417
418
  synchronize do |client|
@@ -422,7 +423,7 @@ class Redis
422
423
  # Get the time to live (in seconds) for a key.
423
424
  #
424
425
  # @param [String] key
425
- # @return [Fixnum] remaining time to live in seconds.
426
+ # @return [Integer] remaining time to live in seconds.
426
427
  #
427
428
  # In Redis 2.6 or older the command returns -1 if the key does not exist or if
428
429
  # the key exist but has no associated expire.
@@ -440,7 +441,7 @@ class Redis
440
441
  # Set a key's time to live in milliseconds.
441
442
  #
442
443
  # @param [String] key
443
- # @param [Fixnum] milliseconds time to live
444
+ # @param [Integer] milliseconds time to live
444
445
  # @return [Boolean] whether the timeout was set or not
445
446
  def pexpire(key, milliseconds)
446
447
  synchronize do |client|
@@ -451,7 +452,7 @@ class Redis
451
452
  # Set the expiration for a key as number of milliseconds from UNIX Epoch.
452
453
  #
453
454
  # @param [String] key
454
- # @param [Fixnum] ms_unix_time expiry time specified as number of milliseconds from UNIX Epoch.
455
+ # @param [Integer] ms_unix_time expiry time specified as number of milliseconds from UNIX Epoch.
455
456
  # @return [Boolean] whether the timeout was set or not
456
457
  def pexpireat(key, ms_unix_time)
457
458
  synchronize do |client|
@@ -462,7 +463,7 @@ class Redis
462
463
  # Get the time to live (in milliseconds) for a key.
463
464
  #
464
465
  # @param [String] key
465
- # @return [Fixnum] remaining time to live in milliseconds
466
+ # @return [Integer] remaining time to live in milliseconds
466
467
  # In Redis 2.6 or older the command returns -1 if the key does not exist or if
467
468
  # the key exist but has no associated expire.
468
469
  #
@@ -532,7 +533,7 @@ class Redis
532
533
  # Delete one or more keys.
533
534
  #
534
535
  # @param [String, Array<String>] keys
535
- # @return [Fixnum] number of keys that were deleted
536
+ # @return [Integer] number of keys that were deleted
536
537
  def del(*keys)
537
538
  synchronize do |client|
538
539
  client.call([:del] + keys)
@@ -542,7 +543,7 @@ class Redis
542
543
  # Unlink one or more keys.
543
544
  #
544
545
  # @param [String, Array<String>] keys
545
- # @return [Fixnum] number of keys that were unlinked
546
+ # @return [Integer] number of keys that were unlinked
546
547
  def unlink(*keys)
547
548
  synchronize do |client|
548
549
  client.call([:unlink] + keys)
@@ -592,7 +593,7 @@ class Redis
592
593
  # # => "bar"
593
594
  #
594
595
  # @param [String] key
595
- # @param [Fixnum] db
596
+ # @param [Integer] db
596
597
  # @return [Boolean] whether the key was moved or not
597
598
  def move(key, db)
598
599
  synchronize do |client|
@@ -656,7 +657,7 @@ class Redis
656
657
  # - `:order => String`: combination of `ASC`, `DESC` and optionally `ALPHA`
657
658
  # - `:store => String`: key to store the result at
658
659
  #
659
- # @return [Array<String>, Array<Array<String>>, Fixnum]
660
+ # @return [Array<String>, Array<Array<String>>, Integer]
660
661
  # - when `:get` is not specified, or holds a single element, an array of elements
661
662
  # - when `:get` is specified, and holds more than one element, an array of
662
663
  # elements where every element is an array with the result for every
@@ -710,7 +711,7 @@ class Redis
710
711
  # # => 4
711
712
  #
712
713
  # @param [String] key
713
- # @return [Fixnum] value after decrementing it
714
+ # @return [Integer] value after decrementing it
714
715
  def decr(key)
715
716
  synchronize do |client|
716
717
  client.call([:decr, key])
@@ -724,8 +725,8 @@ class Redis
724
725
  # # => 0
725
726
  #
726
727
  # @param [String] key
727
- # @param [Fixnum] decrement
728
- # @return [Fixnum] value after decrementing it
728
+ # @param [Integer] decrement
729
+ # @return [Integer] value after decrementing it
729
730
  def decrby(key, decrement)
730
731
  synchronize do |client|
731
732
  client.call([:decrby, key, decrement])
@@ -739,7 +740,7 @@ class Redis
739
740
  # # => 6
740
741
  #
741
742
  # @param [String] key
742
- # @return [Fixnum] value after incrementing it
743
+ # @return [Integer] value after incrementing it
743
744
  def incr(key)
744
745
  synchronize do |client|
745
746
  client.call([:incr, key])
@@ -753,8 +754,8 @@ class Redis
753
754
  # # => 10
754
755
  #
755
756
  # @param [String] key
756
- # @param [Fixnum] increment
757
- # @return [Fixnum] value after incrementing it
757
+ # @param [Integer] increment
758
+ # @return [Integer] value after incrementing it
758
759
  def incrby(key, increment)
759
760
  synchronize do |client|
760
761
  client.call([:incrby, key, increment])
@@ -781,8 +782,8 @@ class Redis
781
782
  # @param [String] key
782
783
  # @param [String] value
783
784
  # @param [Hash] options
784
- # - `:ex => Fixnum`: Set the specified expire time, in seconds.
785
- # - `:px => Fixnum`: Set the specified expire time, in milliseconds.
785
+ # - `:ex => Integer`: Set the specified expire time, in seconds.
786
+ # - `:px => Integer`: Set the specified expire time, in milliseconds.
786
787
  # - `:nx => true`: Only set the key if it does not already exist.
787
788
  # - `:xx => true`: Only set the key if it already exist.
788
789
  # @return [String, Boolean] `"OK"` or true, false if `:nx => true` or `:xx => true`
@@ -813,7 +814,7 @@ class Redis
813
814
  # Set the time to live in seconds of a key.
814
815
  #
815
816
  # @param [String] key
816
- # @param [Fixnum] ttl
817
+ # @param [Integer] ttl
817
818
  # @param [String] value
818
819
  # @return [String] `"OK"`
819
820
  def setex(key, ttl, value)
@@ -825,7 +826,7 @@ class Redis
825
826
  # Set the time to live in milliseconds of a key.
826
827
  #
827
828
  # @param [String] key
828
- # @param [Fixnum] ttl
829
+ # @param [Integer] ttl
829
830
  # @param [String] value
830
831
  # @return [String] `"OK"`
831
832
  def psetex(key, ttl, value)
@@ -918,7 +919,7 @@ class Redis
918
919
  # Get the values of all the given keys.
919
920
  #
920
921
  # @example
921
- # redis.mget("key1", "key1")
922
+ # redis.mget("key1", "key2")
922
923
  # # => ["v1", "v2"]
923
924
  #
924
925
  # @param [Array<String>] keys
@@ -954,9 +955,9 @@ class Redis
954
955
  # Overwrite part of a string at key starting at the specified offset.
955
956
  #
956
957
  # @param [String] key
957
- # @param [Fixnum] offset byte offset
958
+ # @param [Integer] offset byte offset
958
959
  # @param [String] value
959
- # @return [Fixnum] length of the string after it was modified
960
+ # @return [Integer] length of the string after it was modified
960
961
  def setrange(key, offset, value)
961
962
  synchronize do |client|
962
963
  client.call([:setrange, key, offset, value.to_s])
@@ -966,10 +967,10 @@ class Redis
966
967
  # Get a substring of the string stored at a key.
967
968
  #
968
969
  # @param [String] key
969
- # @param [Fixnum] start zero-based start offset
970
- # @param [Fixnum] stop zero-based end offset. Use -1 for representing
970
+ # @param [Integer] start zero-based start offset
971
+ # @param [Integer] stop zero-based end offset. Use -1 for representing
971
972
  # the end of the string
972
- # @return [Fixnum] `0` or `1`
973
+ # @return [Integer] `0` or `1`
973
974
  def getrange(key, start, stop)
974
975
  synchronize do |client|
975
976
  client.call([:getrange, key, start, stop])
@@ -979,9 +980,9 @@ class Redis
979
980
  # Sets or clears the bit at offset in the string value stored at key.
980
981
  #
981
982
  # @param [String] key
982
- # @param [Fixnum] offset bit offset
983
- # @param [Fixnum] value bit value `0` or `1`
984
- # @return [Fixnum] the original bit value stored at `offset`
983
+ # @param [Integer] offset bit offset
984
+ # @param [Integer] value bit value `0` or `1`
985
+ # @return [Integer] the original bit value stored at `offset`
985
986
  def setbit(key, offset, value)
986
987
  synchronize do |client|
987
988
  client.call([:setbit, key, offset, value])
@@ -991,8 +992,8 @@ class Redis
991
992
  # Returns the bit value at offset in the string value stored at key.
992
993
  #
993
994
  # @param [String] key
994
- # @param [Fixnum] offset bit offset
995
- # @return [Fixnum] `0` or `1`
995
+ # @param [Integer] offset bit offset
996
+ # @return [Integer] `0` or `1`
996
997
  def getbit(key, offset)
997
998
  synchronize do |client|
998
999
  client.call([:getbit, key, offset])
@@ -1003,7 +1004,7 @@ class Redis
1003
1004
  #
1004
1005
  # @param [String] key
1005
1006
  # @param [String] value value to append
1006
- # @return [Fixnum] length of the string after appending
1007
+ # @return [Integer] length of the string after appending
1007
1008
  def append(key, value)
1008
1009
  synchronize do |client|
1009
1010
  client.call([:append, key, value])
@@ -1013,9 +1014,9 @@ class Redis
1013
1014
  # Count the number of set bits in a range of the string value stored at key.
1014
1015
  #
1015
1016
  # @param [String] key
1016
- # @param [Fixnum] start start index
1017
- # @param [Fixnum] stop stop index
1018
- # @return [Fixnum] the number of bits set to 1
1017
+ # @param [Integer] start start index
1018
+ # @param [Integer] stop stop index
1019
+ # @return [Integer] the number of bits set to 1
1019
1020
  def bitcount(key, start = 0, stop = -1)
1020
1021
  synchronize do |client|
1021
1022
  client.call([:bitcount, key, start, stop])
@@ -1027,7 +1028,7 @@ class Redis
1027
1028
  # @param [String] operation e.g. `and`, `or`, `xor`, `not`
1028
1029
  # @param [String] destkey destination key
1029
1030
  # @param [String, Array<String>] keys one or more source keys to perform `operation`
1030
- # @return [Fixnum] the length of the string stored in `destkey`
1031
+ # @return [Integer] the length of the string stored in `destkey`
1031
1032
  def bitop(operation, destkey, *keys)
1032
1033
  synchronize do |client|
1033
1034
  client.call([:bitop, operation, destkey] + keys)
@@ -1037,10 +1038,10 @@ class Redis
1037
1038
  # Return the position of the first bit set to 1 or 0 in a string.
1038
1039
  #
1039
1040
  # @param [String] key
1040
- # @param [Fixnum] bit whether to look for the first 1 or 0 bit
1041
- # @param [Fixnum] start start index
1042
- # @param [Fixnum] stop stop index
1043
- # @return [Fixnum] the position of the first 1/0 bit.
1041
+ # @param [Integer] bit whether to look for the first 1 or 0 bit
1042
+ # @param [Integer] start start index
1043
+ # @param [Integer] stop stop index
1044
+ # @return [Integer] the position of the first 1/0 bit.
1044
1045
  # -1 if looking for 1 and it is not found or start and stop are given.
1045
1046
  def bitpos(key, bit, start=nil, stop=nil)
1046
1047
  if stop and not start
@@ -1070,7 +1071,7 @@ class Redis
1070
1071
  # Get the length of the value stored in a key.
1071
1072
  #
1072
1073
  # @param [String] key
1073
- # @return [Fixnum] the length of the value stored in the key, or 0
1074
+ # @return [Integer] the length of the value stored in the key, or 0
1074
1075
  # if the key does not exist
1075
1076
  def strlen(key)
1076
1077
  synchronize do |client|
@@ -1081,7 +1082,7 @@ class Redis
1081
1082
  # Get the length of a list.
1082
1083
  #
1083
1084
  # @param [String] key
1084
- # @return [Fixnum]
1085
+ # @return [Integer]
1085
1086
  def llen(key)
1086
1087
  synchronize do |client|
1087
1088
  client.call([:llen, key])
@@ -1092,7 +1093,7 @@ class Redis
1092
1093
  #
1093
1094
  # @param [String] key
1094
1095
  # @param [String, Array<String>] value string value, or array of string values to push
1095
- # @return [Fixnum] the length of the list after the push operation
1096
+ # @return [Integer] the length of the list after the push operation
1096
1097
  def lpush(key, value)
1097
1098
  synchronize do |client|
1098
1099
  client.call([:lpush, key, value])
@@ -1103,7 +1104,7 @@ class Redis
1103
1104
  #
1104
1105
  # @param [String] key
1105
1106
  # @param [String] value
1106
- # @return [Fixnum] the length of the list after the push operation
1107
+ # @return [Integer] the length of the list after the push operation
1107
1108
  def lpushx(key, value)
1108
1109
  synchronize do |client|
1109
1110
  client.call([:lpushx, key, value])
@@ -1114,7 +1115,7 @@ class Redis
1114
1115
  #
1115
1116
  # @param [String] key
1116
1117
  # @param [String, Array<String>] value string value, or array of string values to push
1117
- # @return [Fixnum] the length of the list after the push operation
1118
+ # @return [Integer] the length of the list after the push operation
1118
1119
  def rpush(key, value)
1119
1120
  synchronize do |client|
1120
1121
  client.call([:rpush, key, value])
@@ -1125,7 +1126,7 @@ class Redis
1125
1126
  #
1126
1127
  # @param [String] key
1127
1128
  # @param [String] value
1128
- # @return [Fixnum] the length of the list after the push operation
1129
+ # @return [Integer] the length of the list after the push operation
1129
1130
  def rpushx(key, value)
1130
1131
  synchronize do |client|
1131
1132
  client.call([:rpushx, key, value])
@@ -1164,21 +1165,21 @@ class Redis
1164
1165
  end
1165
1166
 
1166
1167
  def _bpop(cmd, args, &blk)
1167
- options = {}
1168
-
1169
- if args.last.is_a?(Hash)
1168
+ timeout = if args.last.is_a?(Hash)
1170
1169
  options = args.pop
1170
+ options[:timeout]
1171
1171
  elsif args.last.respond_to?(:to_int)
1172
1172
  # Issue deprecation notice in obnoxious mode...
1173
- options[:timeout] = args.pop.to_int
1173
+ args.pop.to_int
1174
1174
  end
1175
1175
 
1176
+ timeout ||= 0
1177
+
1176
1178
  if args.size > 1
1177
1179
  # Issue deprecation notice in obnoxious mode...
1178
1180
  end
1179
1181
 
1180
1182
  keys = args.flatten
1181
- timeout = options[:timeout] || 0
1182
1183
 
1183
1184
  synchronize do |client|
1184
1185
  command = [cmd, keys, timeout]
@@ -1203,7 +1204,7 @@ class Redis
1203
1204
  # @param [String, Array<String>] keys one or more keys to perform the
1204
1205
  # blocking pop on
1205
1206
  # @param [Hash] options
1206
- # - `:timeout => Fixnum`: timeout in seconds, defaults to no timeout
1207
+ # - `:timeout => Integer`: timeout in seconds, defaults to no timeout
1207
1208
  #
1208
1209
  # @return [nil, [String, String]]
1209
1210
  # - `nil` when the operation timed out
@@ -1217,7 +1218,7 @@ class Redis
1217
1218
  # @param [String, Array<String>] keys one or more keys to perform the
1218
1219
  # blocking pop on
1219
1220
  # @param [Hash] options
1220
- # - `:timeout => Fixnum`: timeout in seconds, defaults to no timeout
1221
+ # - `:timeout => Integer`: timeout in seconds, defaults to no timeout
1221
1222
  #
1222
1223
  # @return [nil, [String, String]]
1223
1224
  # - `nil` when the operation timed out
@@ -1234,7 +1235,7 @@ class Redis
1234
1235
  # @param [String] source source key
1235
1236
  # @param [String] destination destination key
1236
1237
  # @param [Hash] options
1237
- # - `:timeout => Fixnum`: timeout in seconds, defaults to no timeout
1238
+ # - `:timeout => Integer`: timeout in seconds, defaults to no timeout
1238
1239
  #
1239
1240
  # @return [nil, String]
1240
1241
  # - `nil` when the operation timed out
@@ -1258,7 +1259,7 @@ class Redis
1258
1259
  # Get an element from a list by its index.
1259
1260
  #
1260
1261
  # @param [String] key
1261
- # @param [Fixnum] index
1262
+ # @param [Integer] index
1262
1263
  # @return [String]
1263
1264
  def lindex(key, index)
1264
1265
  synchronize do |client|
@@ -1272,7 +1273,7 @@ class Redis
1272
1273
  # @param [String, Symbol] where `BEFORE` or `AFTER`
1273
1274
  # @param [String] pivot reference element
1274
1275
  # @param [String] value
1275
- # @return [Fixnum] length of the list after the insert operation, or `-1`
1276
+ # @return [Integer] length of the list after the insert operation, or `-1`
1276
1277
  # when the element `pivot` was not found
1277
1278
  def linsert(key, where, pivot, value)
1278
1279
  synchronize do |client|
@@ -1283,8 +1284,8 @@ class Redis
1283
1284
  # Get a range of elements from a list.
1284
1285
  #
1285
1286
  # @param [String] key
1286
- # @param [Fixnum] start start index
1287
- # @param [Fixnum] stop stop index
1287
+ # @param [Integer] start start index
1288
+ # @param [Integer] stop stop index
1288
1289
  # @return [Array<String>]
1289
1290
  def lrange(key, start, stop)
1290
1291
  synchronize do |client|
@@ -1295,12 +1296,12 @@ class Redis
1295
1296
  # Remove elements from a list.
1296
1297
  #
1297
1298
  # @param [String] key
1298
- # @param [Fixnum] count number of elements to remove. Use a positive
1299
+ # @param [Integer] count number of elements to remove. Use a positive
1299
1300
  # value to remove the first `count` occurrences of `value`. A negative
1300
1301
  # value to remove the last `count` occurrences of `value`. Or zero, to
1301
1302
  # remove all occurrences of `value` from the list.
1302
1303
  # @param [String] value
1303
- # @return [Fixnum] the number of removed elements
1304
+ # @return [Integer] the number of removed elements
1304
1305
  def lrem(key, count, value)
1305
1306
  synchronize do |client|
1306
1307
  client.call([:lrem, key, count, value])
@@ -1310,7 +1311,7 @@ class Redis
1310
1311
  # Set the value of an element in a list by its index.
1311
1312
  #
1312
1313
  # @param [String] key
1313
- # @param [Fixnum] index
1314
+ # @param [Integer] index
1314
1315
  # @param [String] value
1315
1316
  # @return [String] `OK`
1316
1317
  def lset(key, index, value)
@@ -1322,8 +1323,8 @@ class Redis
1322
1323
  # Trim a list to the specified range.
1323
1324
  #
1324
1325
  # @param [String] key
1325
- # @param [Fixnum] start start index
1326
- # @param [Fixnum] stop stop index
1326
+ # @param [Integer] start start index
1327
+ # @param [Integer] stop stop index
1327
1328
  # @return [String] `OK`
1328
1329
  def ltrim(key, start, stop)
1329
1330
  synchronize do |client|
@@ -1334,7 +1335,7 @@ class Redis
1334
1335
  # Get the number of members in a set.
1335
1336
  #
1336
1337
  # @param [String] key
1337
- # @return [Fixnum]
1338
+ # @return [Integer]
1338
1339
  def scard(key)
1339
1340
  synchronize do |client|
1340
1341
  client.call([:scard, key])
@@ -1345,8 +1346,8 @@ class Redis
1345
1346
  #
1346
1347
  # @param [String] key
1347
1348
  # @param [String, Array<String>] member one member, or array of members
1348
- # @return [Boolean, Fixnum] `Boolean` when a single member is specified,
1349
- # holding whether or not adding the member succeeded, or `Fixnum` when an
1349
+ # @return [Boolean, Integer] `Boolean` when a single member is specified,
1350
+ # holding whether or not adding the member succeeded, or `Integer` when an
1350
1351
  # array of members is specified, holding the number of members that were
1351
1352
  # successfully added
1352
1353
  def sadd(key, member)
@@ -1367,8 +1368,8 @@ class Redis
1367
1368
  #
1368
1369
  # @param [String] key
1369
1370
  # @param [String, Array<String>] member one member, or array of members
1370
- # @return [Boolean, Fixnum] `Boolean` when a single member is specified,
1371
- # holding whether or not removing the member succeeded, or `Fixnum` when an
1371
+ # @return [Boolean, Integer] `Boolean` when a single member is specified,
1372
+ # holding whether or not removing the member succeeded, or `Integer` when an
1372
1373
  # array of members is specified, holding the number of members that were
1373
1374
  # successfully removed
1374
1375
  def srem(key, member)
@@ -1389,7 +1390,7 @@ class Redis
1389
1390
  #
1390
1391
  # @param [String] key
1391
1392
  # @return [String]
1392
- # @param [Fixnum] count
1393
+ # @param [Integer] count
1393
1394
  def spop(key, count = nil)
1394
1395
  synchronize do |client|
1395
1396
  if count.nil?
@@ -1403,7 +1404,7 @@ class Redis
1403
1404
  # Get one or more random members from a set.
1404
1405
  #
1405
1406
  # @param [String] key
1406
- # @param [Fixnum] count
1407
+ # @param [Integer] count
1407
1408
  # @return [String]
1408
1409
  def srandmember(key, count = nil)
1409
1410
  synchronize do |client|
@@ -1462,7 +1463,7 @@ class Redis
1462
1463
  #
1463
1464
  # @param [String] destination destination key
1464
1465
  # @param [String, Array<String>] keys keys pointing to sets to subtract
1465
- # @return [Fixnum] number of elements in the resulting set
1466
+ # @return [Integer] number of elements in the resulting set
1466
1467
  def sdiffstore(destination, *keys)
1467
1468
  synchronize do |client|
1468
1469
  client.call([:sdiffstore, destination] + keys)
@@ -1483,7 +1484,7 @@ class Redis
1483
1484
  #
1484
1485
  # @param [String] destination destination key
1485
1486
  # @param [String, Array<String>] keys keys pointing to sets to intersect
1486
- # @return [Fixnum] number of elements in the resulting set
1487
+ # @return [Integer] number of elements in the resulting set
1487
1488
  def sinterstore(destination, *keys)
1488
1489
  synchronize do |client|
1489
1490
  client.call([:sinterstore, destination] + keys)
@@ -1504,7 +1505,7 @@ class Redis
1504
1505
  #
1505
1506
  # @param [String] destination destination key
1506
1507
  # @param [String, Array<String>] keys keys pointing to sets to unify
1507
- # @return [Fixnum] number of elements in the resulting set
1508
+ # @return [Integer] number of elements in the resulting set
1508
1509
  def sunionstore(destination, *keys)
1509
1510
  synchronize do |client|
1510
1511
  client.call([:sunionstore, destination] + keys)
@@ -1518,7 +1519,7 @@ class Redis
1518
1519
  # # => 4
1519
1520
  #
1520
1521
  # @param [String] key
1521
- # @return [Fixnum]
1522
+ # @return [Integer]
1522
1523
  def zcard(key)
1523
1524
  synchronize do |client|
1524
1525
  client.call([:zcard, key])
@@ -1549,10 +1550,10 @@ class Redis
1549
1550
  # - `:incr => true`: When this option is specified ZADD acts like
1550
1551
  # ZINCRBY; only one score-element pair can be specified in this mode
1551
1552
  #
1552
- # @return [Boolean, Fixnum, Float]
1553
+ # @return [Boolean, Integer, Float]
1553
1554
  # - `Boolean` when a single pair is specified, holding whether or not it was
1554
1555
  # **added** to the sorted set.
1555
- # - `Fixnum` when an array of pairs is specified, holding the number of
1556
+ # - `Integer` when an array of pairs is specified, holding the number of
1556
1557
  # pairs that were **added** to the sorted set.
1557
1558
  # - `Float` when option :incr is specified, holding the score of the member
1558
1559
  # after incrementing it.
@@ -1615,10 +1616,10 @@ class Redis
1615
1616
  # - a single member
1616
1617
  # - an array of members
1617
1618
  #
1618
- # @return [Boolean, Fixnum]
1619
+ # @return [Boolean, Integer]
1619
1620
  # - `Boolean` when a single member is specified, holding whether or not it
1620
1621
  # was removed from the sorted set
1621
- # - `Fixnum` when an array of pairs is specified, holding the number of
1622
+ # - `Integer` when an array of pairs is specified, holding the number of
1622
1623
  # members that were removed to the sorted set
1623
1624
  def zrem(key, member)
1624
1625
  synchronize do |client|
@@ -1743,8 +1744,8 @@ class Redis
1743
1744
  # # => [["a", 32.0], ["b", 64.0]]
1744
1745
  #
1745
1746
  # @param [String] key
1746
- # @param [Fixnum] start start index
1747
- # @param [Fixnum] stop stop index
1747
+ # @param [Integer] start start index
1748
+ # @param [Integer] stop stop index
1748
1749
  # @param [Hash] options
1749
1750
  # - `:with_scores => true`: include scores in output
1750
1751
  #
@@ -1796,7 +1797,7 @@ class Redis
1796
1797
  #
1797
1798
  # @param [String] key
1798
1799
  # @param [String] member
1799
- # @return [Fixnum]
1800
+ # @return [Integer]
1800
1801
  def zrank(key, member)
1801
1802
  synchronize do |client|
1802
1803
  client.call([:zrank, key, member])
@@ -1808,7 +1809,7 @@ class Redis
1808
1809
  #
1809
1810
  # @param [String] key
1810
1811
  # @param [String] member
1811
- # @return [Fixnum]
1812
+ # @return [Integer]
1812
1813
  def zrevrank(key, member)
1813
1814
  synchronize do |client|
1814
1815
  client.call([:zrevrank, key, member])
@@ -1825,9 +1826,9 @@ class Redis
1825
1826
  # # => 5
1826
1827
  #
1827
1828
  # @param [String] key
1828
- # @param [Fixnum] start start index
1829
- # @param [Fixnum] stop stop index
1830
- # @return [Fixnum] number of members that were removed
1829
+ # @param [Integer] start start index
1830
+ # @param [Integer] stop stop index
1831
+ # @return [Integer] number of members that were removed
1831
1832
  def zremrangebyrank(key, start, stop)
1832
1833
  synchronize do |client|
1833
1834
  client.call([:zremrangebyrank, key, start, stop])
@@ -1851,7 +1852,7 @@ class Redis
1851
1852
  # - inclusive maximum is specified by prefixing `(`
1852
1853
  # - exclusive maximum is specified by prefixing `[`
1853
1854
  #
1854
- # @return [Fixnum] number of members within the specified lexicographical range
1855
+ # @return [Integer] number of members within the specified lexicographical range
1855
1856
  def zlexcount(key, min, max)
1856
1857
  synchronize do |client|
1857
1858
  client.call([:zlexcount, key, min, max])
@@ -2005,7 +2006,7 @@ class Redis
2005
2006
  # @param [String] max
2006
2007
  # - inclusive maximum score is specified verbatim
2007
2008
  # - exclusive maximum score is specified by prefixing `(`
2008
- # @return [Fixnum] number of members that were removed
2009
+ # @return [Integer] number of members that were removed
2009
2010
  def zremrangebyscore(key, min, max)
2010
2011
  synchronize do |client|
2011
2012
  client.call([:zremrangebyscore, key, min, max])
@@ -2028,7 +2029,7 @@ class Redis
2028
2029
  # @param [String] max
2029
2030
  # - inclusive maximum score is specified verbatim
2030
2031
  # - exclusive maximum score is specified by prefixing `(`
2031
- # @return [Fixnum] number of members in within the specified range
2032
+ # @return [Integer] number of members in within the specified range
2032
2033
  def zcount(key, min, max)
2033
2034
  synchronize do |client|
2034
2035
  client.call([:zcount, key, min, max])
@@ -2048,7 +2049,7 @@ class Redis
2048
2049
  # - `:weights => [Float, Float, ...]`: weights to associate with source
2049
2050
  # sorted sets
2050
2051
  # - `:aggregate => String`: aggregate function to use (sum, min, max, ...)
2051
- # @return [Fixnum] number of elements in the resulting sorted set
2052
+ # @return [Integer] number of elements in the resulting sorted set
2052
2053
  def zinterstore(destination, keys, options = {})
2053
2054
  args = []
2054
2055
 
@@ -2075,7 +2076,7 @@ class Redis
2075
2076
  # - `:weights => [Float, Float, ...]`: weights to associate with source
2076
2077
  # sorted sets
2077
2078
  # - `:aggregate => String`: aggregate function to use (sum, min, max, ...)
2078
- # @return [Fixnum] number of elements in the resulting sorted set
2079
+ # @return [Integer] number of elements in the resulting sorted set
2079
2080
  def zunionstore(destination, keys, options = {})
2080
2081
  args = []
2081
2082
 
@@ -2093,7 +2094,7 @@ class Redis
2093
2094
  # Get the number of fields in a hash.
2094
2095
  #
2095
2096
  # @param [String] key
2096
- # @return [Fixnum] number of fields in the hash
2097
+ # @return [Integer] number of fields in the hash
2097
2098
  def hlen(key)
2098
2099
  synchronize do |client|
2099
2100
  client.call([:hlen, key])
@@ -2209,7 +2210,7 @@ class Redis
2209
2210
  #
2210
2211
  # @param [String] key
2211
2212
  # @param [String, Array<String>] field
2212
- # @return [Fixnum] the number of fields that were removed from the hash
2213
+ # @return [Integer] the number of fields that were removed from the hash
2213
2214
  def hdel(key, *fields)
2214
2215
  synchronize do |client|
2215
2216
  client.call([:hdel, key, *fields])
@@ -2231,8 +2232,8 @@ class Redis
2231
2232
  #
2232
2233
  # @param [String] key
2233
2234
  # @param [String] field
2234
- # @param [Fixnum] increment
2235
- # @return [Fixnum] value of the field after incrementing it
2235
+ # @param [Integer] increment
2236
+ # @return [Integer] value of the field after incrementing it
2236
2237
  def hincrby(key, field, increment)
2237
2238
  synchronize do |client|
2238
2239
  client.call([:hincrby, key, field, increment])
@@ -2800,7 +2801,7 @@ class Redis
2800
2801
  # union of the HyperLogLogs contained in the keys.
2801
2802
  #
2802
2803
  # @param [String, Array<String>] keys
2803
- # @return [Fixnum]
2804
+ # @return [Integer]
2804
2805
  def pfcount(*keys)
2805
2806
  synchronize do |client|
2806
2807
  client.call([:pfcount] + keys)
@@ -2823,7 +2824,7 @@ class Redis
2823
2824
  #
2824
2825
  # @param [String] key
2825
2826
  # @param [Array] member arguemnts for member or members: longitude, latitude, name
2826
- # @return [Intger] number of elements added to the sorted set
2827
+ # @return [Integer] number of elements added to the sorted set
2827
2828
  def geoadd(key, *member)
2828
2829
  synchronize do |client|
2829
2830
  client.call([:geoadd, key, *member])
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redis
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.1.1
4
+ version: 4.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ezra Zygmuntowicz
@@ -16,22 +16,8 @@ authors:
16
16
  autorequire:
17
17
  bindir: bin
18
18
  cert_chain: []
19
- date: 2019-05-06 00:00:00.000000000 Z
19
+ date: 2020-05-01 00:00:00.000000000 Z
20
20
  dependencies:
21
- - !ruby/object:Gem::Dependency
22
- name: test-unit
23
- requirement: !ruby/object:Gem::Requirement
24
- requirements:
25
- - - ">="
26
- - !ruby/object:Gem::Version
27
- version: 3.1.5
28
- type: :development
29
- prerelease: false
30
- version_requirements: !ruby/object:Gem::Requirement
31
- requirements:
32
- - - ">="
33
- - !ruby/object:Gem::Version
34
- version: 3.1.5
35
21
  - !ruby/object:Gem::Dependency
36
22
  name: mocha
37
23
  requirement: !ruby/object:Gem::Requirement
@@ -122,15 +108,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
122
108
  requirements:
123
109
  - - ">="
124
110
  - !ruby/object:Gem::Version
125
- version: 2.2.2
111
+ version: 2.3.0
126
112
  required_rubygems_version: !ruby/object:Gem::Requirement
127
113
  requirements:
128
114
  - - ">="
129
115
  - !ruby/object:Gem::Version
130
116
  version: '0'
131
117
  requirements: []
132
- rubyforge_project:
133
- rubygems_version: 2.5.1
118
+ rubygems_version: 3.0.4
134
119
  signing_key:
135
120
  specification_version: 4
136
121
  summary: A Ruby client library for Redis