openaustralia/planningalerts

View on GitHub
sorbet/rbi/gems/redis@5.2.0.rbi

Summary

Maintainability
Test Coverage
# typed: true

# DO NOT EDIT MANUALLY
# This is an autogenerated file for types exported from the `redis` gem.
# Please instead update this file by running `bin/tapioca gem redis`.


# source://redis//lib/redis/errors.rb#3
class Redis
  include ::Redis::Commands::Bitmaps
  include ::Redis::Commands::Cluster
  include ::Redis::Commands::Connection
  include ::Redis::Commands::Geo
  include ::Redis::Commands::Hashes
  include ::Redis::Commands::HyperLogLog
  include ::Redis::Commands::Keys
  include ::Redis::Commands::Lists
  include ::Redis::Commands::Pubsub
  include ::Redis::Commands::Scripting
  include ::Redis::Commands::Server
  include ::Redis::Commands::Sets
  include ::Redis::Commands::SortedSets
  include ::Redis::Commands::Streams
  include ::Redis::Commands::Strings
  include ::Redis::Commands::Transactions
  include ::Redis::Commands

  # Create a new client instance
  #
  # @option options
  # @option options
  # @option options
  # @option options
  # @option options
  # @option options
  # @option options
  # @option options
  # @option options
  # @option options
  # @option options
  # @option options
  # @option options
  # @option options
  # @option options
  # @param options [Hash]
  # @return [Redis] a new client instance
  #
  # source://redis//lib/redis.rb#63
  def initialize(options = T.unsafe(nil)); end

  # source://redis//lib/redis.rb#98
  def _client; end

  # Disconnect the client as quickly and silently as possible.
  #
  # source://redis//lib/redis.rb#88
  def close; end

  # Test whether or not the client is connected
  #
  # @return [Boolean]
  #
  # source://redis//lib/redis.rb#83
  def connected?; end

  # source://redis//lib/redis.rb#122
  def connection; end

  # Disconnect the client as quickly and silently as possible.
  #
  # source://redis//lib/redis.rb#88
  def disconnect!; end

  # source://redis//lib/redis.rb#118
  def dup; end

  # source://redis//lib/redis.rb#110
  def id; end

  # source://redis//lib/redis.rb#114
  def inspect; end

  # source://redis//lib/redis.rb#102
  def pipelined(exception: T.unsafe(nil)); end

  # @yield [_self]
  # @yieldparam _self [Redis] the object that the method was called on
  #
  # source://redis//lib/redis.rb#94
  def with; end

  # Run code without the client reconnecting
  #
  # source://redis//lib/redis.rb#78
  def without_reconnect(&block); end

  private

  # source://redis//lib/redis.rb#164
  def _subscription(method, timeout, channels, block); end

  # source://redis//lib/redis.rb#134
  def initialize_client(options); end

  # source://redis//lib/redis.rb#158
  def send_blocking_command(command, timeout, &block); end

  # source://redis//lib/redis.rb#150
  def send_command(command, &block); end

  # source://redis//lib/redis.rb#146
  def synchronize; end

  class << self
    # source://redis//lib/redis.rb#14
    def deprecate!(message); end

    # Returns the value of attribute raise_deprecations.
    #
    # source://redis//lib/redis.rb#12
    def raise_deprecations; end

    # Sets the attribute raise_deprecations
    #
    # @param value the value to set the attribute raise_deprecations to.
    #
    # source://redis//lib/redis.rb#12
    def raise_deprecations=(_arg0); end

    # Returns the value of attribute silence_deprecations.
    #
    # source://redis//lib/redis.rb#12
    def silence_deprecations; end

    # Sets the attribute silence_deprecations
    #
    # @param value the value to set the attribute silence_deprecations to.
    #
    # source://redis//lib/redis.rb#12
    def silence_deprecations=(_arg0); end
  end
end

# source://redis//lib/redis.rb#8
Redis::BASE_PATH = T.let(T.unsafe(nil), String)

# Base error for connection related errors.
#
# source://redis//lib/redis/errors.rb#33
class Redis::BaseConnectionError < ::Redis::BaseError; end

# Base error for all redis-rb errors.
#
# source://redis//lib/redis/errors.rb#5
class Redis::BaseError < ::StandardError; end

# Raised when connection to a Redis server cannot be made.
#
# source://redis//lib/redis/errors.rb#37
class Redis::CannotConnectError < ::Redis::BaseConnectionError; end

# source://redis//lib/redis/client.rb#6
class Redis::Client < ::RedisClient
  # source://redis//lib/redis/client.rb#95
  def blocking_call_v(timeout, command, &block); end

  # source://redis//lib/redis/client.rb#89
  def call_v(command, &block); end

  # source://redis//lib/redis/client.rb#60
  def db; end

  # source://redis//lib/redis/client.rb#64
  def host; end

  # source://redis//lib/redis/client.rb#48
  def id; end

  # source://redis//lib/redis/client.rb#120
  def inherit_socket!; end

  # source://redis//lib/redis/client.rb#114
  def multi(watch: T.unsafe(nil)); end

  # source://redis//lib/redis/client.rb#80
  def password; end

  # source://redis//lib/redis/client.rb#72
  def path; end

  # source://redis//lib/redis/client.rb#108
  def pipelined(exception: T.unsafe(nil)); end

  # source://redis//lib/redis/client.rb#68
  def port; end

  # source://redis//lib/redis/client.rb#52
  def server_url; end

  # source://redis//lib/redis/client.rb#56
  def timeout; end

  # source://redis//lib/redis/client.rb#76
  def username; end

  class << self
    # source://redis//lib/redis/client.rb#22
    def config(**kwargs); end

    # source://redis//lib/redis/client.rb#26
    def sentinel(**kwargs); end

    # @raise [redis_error]
    #
    # source://redis//lib/redis/client.rb#30
    def translate_error!(error, mapping: T.unsafe(nil)); end

    private

    # source://redis//lib/redis/client.rb#37
    def translate_error_class(error_class, mapping: T.unsafe(nil)); end
  end
end

# source://redis//lib/redis/client.rb#7
Redis::Client::ERROR_MAPPING = T.let(T.unsafe(nil), Hash)

# Raised by the client when command execution returns an error reply.
#
# source://redis//lib/redis/errors.rb#20
class Redis::CommandError < ::Redis::BaseError; end

# source://redis//lib/redis/commands/bitmaps.rb#4
module Redis::Commands
  include ::Redis::Commands::Bitmaps
  include ::Redis::Commands::Cluster
  include ::Redis::Commands::Connection
  include ::Redis::Commands::Geo
  include ::Redis::Commands::Hashes
  include ::Redis::Commands::HyperLogLog
  include ::Redis::Commands::Keys
  include ::Redis::Commands::Lists
  include ::Redis::Commands::Pubsub
  include ::Redis::Commands::Scripting
  include ::Redis::Commands::Server
  include ::Redis::Commands::Sets
  include ::Redis::Commands::SortedSets
  include ::Redis::Commands::Streams
  include ::Redis::Commands::Strings
  include ::Redis::Commands::Transactions

  # Sends a command to Redis and returns its reply.
  #
  # Replies are converted to Ruby objects according to the RESP protocol, so
  # you can expect a Ruby array, integer or nil when Redis sends one. Higher
  # level transformations, such as converting an array of pairs into a Ruby
  # hash, are up to consumers.
  #
  # Redis error replies are raised as Ruby exceptions.
  #
  # source://redis//lib/redis/commands.rb#202
  def call(*command); end

  # Interact with the sentinel command (masters, master, slaves, failover)
  #
  # @param subcommand [String] e.g. `masters`, `master`, `slaves`
  # @param args [Array<String>] depends on subcommand
  # @return [Array<String>, Hash<String, String>, String] depends on subcommand
  #
  # source://redis//lib/redis/commands.rb#211
  def sentinel(subcommand, *args); end

  private

  # source://redis//lib/redis/commands.rb#233
  def method_missing(*command); end
end

# source://redis//lib/redis/commands/bitmaps.rb#5
module Redis::Commands::Bitmaps
  # Count the number of set bits in a range of the string value stored at key.
  #
  # @param key [String]
  # @param start [Integer] start index
  # @param stop [Integer] stop index
  # @param scale [String, Symbol] the scale of the offset range
  #   e.g. 'BYTE' - interpreted as a range of bytes, 'BIT' - interpreted as a range of bits
  # @return [Integer] the number of bits set to 1
  #
  # source://redis//lib/redis/commands/bitmaps.rb#33
  def bitcount(key, start = T.unsafe(nil), stop = T.unsafe(nil), scale: T.unsafe(nil)); end

  # Perform a bitwise operation between strings and store the resulting string in a key.
  #
  # @param operation [String] e.g. `and`, `or`, `xor`, `not`
  # @param destkey [String] destination key
  # @param keys [String, Array<String>] one or more source keys to perform `operation`
  # @return [Integer] the length of the string stored in `destkey`
  #
  # source://redis//lib/redis/commands/bitmaps.rb#45
  def bitop(operation, destkey, *keys); end

  # Return the position of the first bit set to 1 or 0 in a string.
  #
  # @param key [String]
  # @param bit [Integer] whether to look for the first 1 or 0 bit
  # @param start [Integer] start index
  # @param stop [Integer] stop index
  # @param scale [String, Symbol] the scale of the offset range
  #   e.g. 'BYTE' - interpreted as a range of bytes, 'BIT' - interpreted as a range of bits
  # @raise [ArgumentError]
  # @return [Integer] the position of the first 1/0 bit.
  #   -1 if looking for 1 and it is not found or start and stop are given.
  #
  # source://redis//lib/redis/commands/bitmaps.rb#62
  def bitpos(key, bit, start = T.unsafe(nil), stop = T.unsafe(nil), scale: T.unsafe(nil)); end

  # Returns the bit value at offset in the string value stored at key.
  #
  # @param key [String]
  # @param offset [Integer] bit offset
  # @return [Integer] `0` or `1`
  #
  # source://redis//lib/redis/commands/bitmaps.rb#21
  def getbit(key, offset); end

  # Sets or clears the bit at offset in the string value stored at key.
  #
  # @param key [String]
  # @param offset [Integer] bit offset
  # @param value [Integer] bit value `0` or `1`
  # @return [Integer] the original bit value stored at `offset`
  #
  # source://redis//lib/redis/commands/bitmaps.rb#12
  def setbit(key, offset, value); end
end

# Commands returning 1 for true and 0 for false may be executed in a pipeline
# where the method call will return nil. Propagate the nil instead of falsely
# returning false.
#
# source://redis//lib/redis/commands.rb#42
Redis::Commands::Boolify = T.let(T.unsafe(nil), Proc)

# source://redis//lib/redis/commands.rb#46
Redis::Commands::BoolifySet = T.let(T.unsafe(nil), Proc)

# source://redis//lib/redis/commands/cluster.rb#5
module Redis::Commands::Cluster
  # Sends `ASKING` command to random node and returns its reply.
  #
  # @return [String] `'OK'`
  # @see https://redis.io/topics/cluster-spec#ask-redirection ASK redirection
  #
  # source://redis//lib/redis/commands/cluster.rb#23
  def asking; end

  # Sends `CLUSTER *` command to random node and returns its reply.
  #
  # @param subcommand [String, Symbol] the subcommand of cluster command
  #   e.g. `:slots`, `:nodes`, `:slaves`, `:info`
  # @return [Object] depends on the subcommand
  # @see https://redis.io/commands#cluster Reference of cluster command
  #
  # source://redis//lib/redis/commands/cluster.rb#14
  def cluster(subcommand, *args); end
end

# source://redis//lib/redis/commands/connection.rb#5
module Redis::Commands::Connection
  # Authenticate to the server.
  #
  # @param args [Array<String>] includes both username and password
  #   or only password
  # @return [String] `OK`
  # @see https://redis.io/commands/auth AUTH command
  #
  # source://redis//lib/redis/commands/connection.rb#12
  def auth(*args); end

  # Echo the given string.
  #
  # @param value [String]
  # @return [String]
  #
  # source://redis//lib/redis/commands/connection.rb#28
  def echo(value); end

  # Ping the server.
  #
  # @param message [optional, String]
  # @return [String] `PONG`
  #
  # source://redis//lib/redis/commands/connection.rb#20
  def ping(message = T.unsafe(nil)); end

  # Close the connection.
  #
  # @return [String] `OK`
  #
  # source://redis//lib/redis/commands/connection.rb#43
  def quit; end

  # Change the selected database for the current connection.
  #
  # @param db [Integer] zero-based index of the DB to use (0 to 15)
  # @return [String] `OK`
  #
  # source://redis//lib/redis/commands/connection.rb#36
  def select(db); end
end

# source://redis//lib/redis/commands.rb#110
Redis::Commands::EMPTY_STREAM_RESPONSE = T.let(T.unsafe(nil), Array)

# source://redis//lib/redis/commands.rb#73
Redis::Commands::Floatify = T.let(T.unsafe(nil), Proc)

# source://redis//lib/redis/commands.rb#86
Redis::Commands::FloatifyPairs = T.let(T.unsafe(nil), Proc)

# source://redis//lib/redis/commands/geo.rb#5
module Redis::Commands::Geo
  # Adds the specified geospatial items (latitude, longitude, name) to the specified key
  #
  # @param key [String]
  # @param member [Array] arguemnts for member or members: longitude, latitude, name
  # @return [Integer] number of elements added to the sorted set
  #
  # source://redis//lib/redis/commands/geo.rb#11
  def geoadd(key, *member); end

  # Returns the distance between two members of a geospatial index
  #
  # @param key [String]
  # @param members [Array<String>]
  # @param unit ['m', 'km', 'mi', 'ft']
  # @return [String, nil] returns distance in spefied unit if both members present, nil otherwise.
  #
  # source://redis//lib/redis/commands/geo.rb#70
  def geodist(key, member1, member2, unit = T.unsafe(nil)); end

  # Returns geohash string representing position for specified members of the specified key.
  #
  # @param key [String]
  # @param member [String, Array<String>] one member or array of members
  # @return [Array<String, nil>] returns array containg geohash string if member is present, nil otherwise
  #
  # source://redis//lib/redis/commands/geo.rb#20
  def geohash(key, member); end

  # Returns longitude and latitude of members of a geospatial index
  #
  # @param key [String]
  # @param member [String, Array<String>] one member or array of members
  # @return [Array<Array<String>, nil>] returns array of elements, where each
  #   element is either array of longitude and latitude or nil
  #
  # source://redis//lib/redis/commands/geo.rb#60
  def geopos(key, member); end

  # Query a sorted set representing a geospatial index to fetch members matching a
  # given maximum distance from a point
  #
  # @param args [Array] key, longitude, latitude, radius, unit(m|km|ft|mi)
  # @param sort ['asc', 'desc'] sort returned items from the nearest to the farthest
  #   or the farthest to the nearest relative to the center
  # @param count [Integer] limit the results to the first N matching items
  # @param options ['WITHDIST', 'WITHCOORD', 'WITHHASH'] to return additional information
  # @return [Array<String>] may be changed with `options`
  #
  # source://redis//lib/redis/commands/geo.rb#33
  def georadius(*args, **geoptions); end

  # Query a sorted set representing a geospatial index to fetch members matching a
  # given maximum distance from an already existing member
  #
  # @param args [Array] key, member, radius, unit(m|km|ft|mi)
  # @param sort ['asc', 'desc'] sort returned items from the nearest to the farthest or the farthest
  #   to the nearest relative to the center
  # @param count [Integer] limit the results to the first N matching items
  # @param options ['WITHDIST', 'WITHCOORD', 'WITHHASH'] to return additional information
  # @return [Array<String>] may be changed with `options`
  #
  # source://redis//lib/redis/commands/geo.rb#48
  def georadiusbymember(*args, **geoptions); end

  private

  # source://redis//lib/redis/commands/geo.rb#76
  def _geoarguments(*args, options: T.unsafe(nil), sort: T.unsafe(nil), count: T.unsafe(nil)); end
end

# source://redis//lib/redis/commands/hashes.rb#5
module Redis::Commands::Hashes
  # Delete one or more hash fields.
  #
  # @param key [String]
  # @param field [String, Array<String>]
  # @return [Integer] the number of fields that were removed from the hash
  #
  # source://redis//lib/redis/commands/hashes.rb#156
  def hdel(key, *fields); end

  # Determine if a hash field exists.
  #
  # @param key [String]
  # @param field [String]
  # @return [Boolean] whether or not the field exists in the hash
  #
  # source://redis//lib/redis/commands/hashes.rb#166
  def hexists(key, field); end

  # Get the value of a hash field.
  #
  # @param key [String]
  # @param field [String]
  # @return [String]
  #
  # source://redis//lib/redis/commands/hashes.rb#74
  def hget(key, field); end

  # Get all the fields and values in a hash.
  #
  # @param key [String]
  # @return [Hash<String, String>]
  #
  # source://redis//lib/redis/commands/hashes.rb#210
  def hgetall(key); end

  # Increment the integer value of a hash field by the given integer number.
  #
  # @param key [String]
  # @param field [String]
  # @param increment [Integer]
  # @return [Integer] value of the field after incrementing it
  #
  # source://redis//lib/redis/commands/hashes.rb#176
  def hincrby(key, field, increment); end

  # Increment the numeric value of a hash field by the given float number.
  #
  # @param key [String]
  # @param field [String]
  # @param increment [Float]
  # @return [Float] value of the field after incrementing it
  #
  # source://redis//lib/redis/commands/hashes.rb#186
  def hincrbyfloat(key, field, increment); end

  # Get all the fields in a hash.
  #
  # @param key [String]
  # @return [Array<String>]
  #
  # source://redis//lib/redis/commands/hashes.rb#194
  def hkeys(key); end

  # Get the number of fields in a hash.
  #
  # @param key [String]
  # @return [Integer] number of fields in the hash
  #
  # source://redis//lib/redis/commands/hashes.rb#10
  def hlen(key); end

  # Get the values of all the given hash fields.
  #
  # @example
  #   redis.hmget("hash", "f1", "f2")
  #   # => ["v1", "v2"]
  # @param key [String]
  # @param fields [Array<String>] array of fields
  # @return [Array<String>] an array of values for the specified fields
  # @see #mapped_hmget
  #
  # source://redis//lib/redis/commands/hashes.rb#89
  def hmget(key, *fields, &blk); end

  # Set one or more hash values.
  #
  # @example
  #   redis.hmset("hash", "f1", "v1", "f2", "v2")
  #   # => "OK"
  # @param key [String]
  # @param attrs [Array<String>] array of fields and values
  # @return [String] `"OK"`
  # @see #mapped_hmset
  #
  # source://redis//lib/redis/commands/hashes.rb#50
  def hmset(key, *attrs); end

  # Get one or more random fields from a hash.
  #
  # @example Get one random field
  #   redis.hrandfield("hash")
  #   # => "f1"
  # @example Get multiple random fields
  #   redis.hrandfield("hash", 2)
  #   # => ["f1, "f2"]
  # @example Get multiple random fields with values
  #   redis.hrandfield("hash", 2, with_values: true)
  #   # => [["f1", "s1"], ["f2", "s2"]]
  # @param key [String]
  # @param count [Integer]
  # @param options [Hash] - `:with_values => true`: include values in output
  # @return [nil, String, Array<String>, Array<[String, Float]>] - when `key` does not exist, `nil`
  #   - when `count` is not specified, a field name
  #   - when `count` is specified and `:with_values` is not specified, an array of field names
  #   - when `:with_values` is specified, an array with `[field, value]` pairs
  #
  # source://redis//lib/redis/commands/hashes.rb#138
  def hrandfield(key, count = T.unsafe(nil), withvalues: T.unsafe(nil), with_values: T.unsafe(nil)); end

  # Scan a hash
  #
  # @example Retrieve the first batch of key/value pairs in a hash
  #   redis.hscan("hash", 0)
  # @param cursor [String, Integer] the cursor of the iteration
  # @param options [Hash] - `:match => String`: only return keys matching the pattern
  #   - `:count => Integer`: return count keys at most per iteration
  # @return [String, Array<[String, String]>] the next cursor and all found keys
  #
  # source://redis//lib/redis/commands/hashes.rb#225
  def hscan(key, cursor, **options); end

  # Scan a hash
  #
  # @example Retrieve all of the key/value pairs in a hash
  #   redis.hscan_each("hash").to_a
  #   # => [["key70", "70"], ["key80", "80"]]
  # @param options [Hash] - `:match => String`: only return keys matching the pattern
  #   - `:count => Integer`: return count keys at most per iteration
  # @return [Enumerator] an enumerator for all found keys
  #
  # source://redis//lib/redis/commands/hashes.rb#242
  def hscan_each(key, **options, &block); end

  # Set one or more hash values.
  #
  # @example
  #   redis.hset("hash", "f1", "v1", "f2", "v2") # => 2
  #   redis.hset("hash", { "f1" => "v1", "f2" => "v2" }) # => 2
  # @param key [String]
  # @param attrs [Array<String> | Hash<String, String>] array or hash of fields and values
  # @return [Integer] The number of fields that were added to the hash
  #
  # source://redis//lib/redis/commands/hashes.rb#23
  def hset(key, *attrs); end

  # Set the value of a hash field, only if the field does not exist.
  #
  # @param key [String]
  # @param field [String]
  # @param value [String]
  # @return [Boolean] whether or not the field was **added** to the hash
  #
  # source://redis//lib/redis/commands/hashes.rb#35
  def hsetnx(key, field, value); end

  # Get all the values in a hash.
  #
  # @param key [String]
  # @return [Array<String>]
  #
  # source://redis//lib/redis/commands/hashes.rb#202
  def hvals(key); end

  # Get the values of all the given hash fields.
  #
  # @example
  #   redis.mapped_hmget("hash", "f1", "f2")
  #   # => { "f1" => "v1", "f2" => "v2" }
  # @param key [String]
  # @param fields [Array<String>] array of fields
  # @return [Hash] a hash mapping the specified fields to their values
  # @see #hmget
  #
  # source://redis//lib/redis/commands/hashes.rb#105
  def mapped_hmget(key, *fields); end

  # Set one or more hash values.
  #
  # @example
  #   redis.mapped_hmset("hash", { "f1" => "v1", "f2" => "v2" })
  #   # => "OK"
  # @param key [String]
  # @param hash [Hash] a non-empty hash with fields mapping to values
  # @return [String] `"OK"`
  # @see #hmset
  #
  # source://redis//lib/redis/commands/hashes.rb#65
  def mapped_hmset(key, hash); end
end

# source://redis//lib/redis/commands.rb#57
Redis::Commands::Hashify = T.let(T.unsafe(nil), Proc)

# source://redis//lib/redis/commands.rb#155
Redis::Commands::HashifyClusterNodeInfo = T.let(T.unsafe(nil), Proc)

# source://redis//lib/redis/commands.rb#184
Redis::Commands::HashifyClusterNodes = T.let(T.unsafe(nil), Proc)

# source://redis//lib/redis/commands.rb#188
Redis::Commands::HashifyClusterSlaves = T.let(T.unsafe(nil), Proc)

# source://redis//lib/redis/commands.rb#170
Redis::Commands::HashifyClusterSlots = T.let(T.unsafe(nil), Proc)

# source://redis//lib/redis/commands.rb#94
Redis::Commands::HashifyInfo = T.let(T.unsafe(nil), Proc)

# source://redis//lib/redis/commands.rb#119
Redis::Commands::HashifyStreamAutoclaim = T.let(T.unsafe(nil), Proc)

# source://redis//lib/redis/commands.rb#128
Redis::Commands::HashifyStreamAutoclaimJustId = T.let(T.unsafe(nil), Proc)

# source://redis//lib/redis/commands.rb#113
Redis::Commands::HashifyStreamEntries = T.let(T.unsafe(nil), Proc)

# source://redis//lib/redis/commands.rb#144
Redis::Commands::HashifyStreamPendingDetails = T.let(T.unsafe(nil), Proc)

# source://redis//lib/redis/commands.rb#135
Redis::Commands::HashifyStreamPendings = T.let(T.unsafe(nil), Proc)

# source://redis//lib/redis/commands.rb#101
Redis::Commands::HashifyStreams = T.let(T.unsafe(nil), Proc)

# source://redis//lib/redis/commands/hyper_log_log.rb#5
module Redis::Commands::HyperLogLog
  # Add one or more members to a HyperLogLog structure.
  #
  # @param key [String]
  # @param member [String, Array<String>] one member, or array of members
  # @return [Boolean] true if at least 1 HyperLogLog internal register was altered. false otherwise.
  #
  # source://redis//lib/redis/commands/hyper_log_log.rb#11
  def pfadd(key, member); end

  # Get the approximate cardinality of members added to HyperLogLog structure.
  #
  # If called with multiple keys, returns the approximate cardinality of the
  # union of the HyperLogLogs contained in the keys.
  #
  # @param keys [String, Array<String>]
  # @return [Integer]
  #
  # source://redis//lib/redis/commands/hyper_log_log.rb#22
  def pfcount(*keys); end

  # Merge multiple HyperLogLog values into an unique value that will approximate the cardinality of the union of
  # the observed Sets of the source HyperLogLog structures.
  #
  # @param dest_key [String] destination key
  # @param source_key [String, Array<String>] source key, or array of keys
  # @return [Boolean]
  #
  # source://redis//lib/redis/commands/hyper_log_log.rb#32
  def pfmerge(dest_key, *source_key); end
end

# source://redis//lib/redis/commands/keys.rb#5
module Redis::Commands::Keys
  # Copy a value from one key to another.
  #
  # @example Copy a value to another key
  #   redis.set "foo", "value"
  #   # => "OK"
  #   redis.copy "foo", "bar"
  #   # => true
  #   redis.get "bar"
  #   # => "value"
  # @example Copy a value to a key in another database
  #   redis.set "foo", "value"
  #   # => "OK"
  #   redis.copy "foo", "bar", db: 2
  #   # => true
  #   redis.select 2
  #   # => "OK"
  #   redis.get "bar"
  #   # => "value"
  # @param source [String]
  # @param destination [String]
  # @param db [Integer]
  # @param replace [Boolean] removes the `destination` key before copying value to it
  # @return [Boolean] whether the key was copied or not
  #
  # source://redis//lib/redis/commands/keys.rb#343
  def copy(source, destination, db: T.unsafe(nil), replace: T.unsafe(nil)); end

  # Delete one or more keys.
  #
  # @param keys [String, Array<String>]
  # @return [Integer] number of keys that were deleted
  #
  # source://redis//lib/redis/commands/keys.rb#248
  def del(*keys); end

  # Return a serialized version of the value stored at a key.
  #
  # @param key [String]
  # @return [String] serialized_value
  #
  # source://redis//lib/redis/commands/keys.rb#199
  def dump(key); end

  # Determine how many of the keys exists.
  #
  # @param keys [String, Array<String>]
  # @return [Integer]
  #
  # source://redis//lib/redis/commands/keys.rb#267
  def exists(*keys); end

  # Determine if any of the keys exists.
  #
  # @param keys [String, Array<String>]
  # @return [Boolean]
  #
  # source://redis//lib/redis/commands/keys.rb#275
  def exists?(*keys); end

  # Set a key's time to live in seconds.
  #
  # @param key [String]
  # @param seconds [Integer] time to live
  # @param options [Hash] - `:nx => true`: Set expiry only when the key has no expiry.
  #   - `:xx => true`: Set expiry only when the key has an existing expiry.
  #   - `:gt => true`: Set expiry only when the new expiry is greater than current one.
  #   - `:lt => true`: Set expiry only when the new expiry is less than current one.
  # @return [Boolean] whether the timeout was set or not
  #
  # source://redis//lib/redis/commands/keys.rb#78
  def expire(key, seconds, nx: T.unsafe(nil), xx: T.unsafe(nil), gt: T.unsafe(nil), lt: T.unsafe(nil)); end

  # Set the expiration for a key as a UNIX timestamp.
  #
  # @param key [String]
  # @param unix_time [Integer] expiry time specified as a UNIX timestamp
  # @param options [Hash] - `:nx => true`: Set expiry only when the key has no expiry.
  #   - `:xx => true`: Set expiry only when the key has an existing expiry.
  #   - `:gt => true`: Set expiry only when the new expiry is greater than current one.
  #   - `:lt => true`: Set expiry only when the new expiry is less than current one.
  # @return [Boolean] whether the timeout was set or not
  #
  # source://redis//lib/redis/commands/keys.rb#98
  def expireat(key, unix_time, nx: T.unsafe(nil), xx: T.unsafe(nil), gt: T.unsafe(nil), lt: T.unsafe(nil)); end

  # Get a key's expiry time specified as number of seconds from UNIX Epoch
  #
  # @param key [String]
  # @return [Integer] expiry time specified as number of seconds from UNIX Epoch
  #
  # source://redis//lib/redis/commands/keys.rb#112
  def expiretime(key); end

  # Find all keys matching the given pattern.
  #
  # @param pattern [String]
  # @return [Array<String>]
  #
  # source://redis//lib/redis/commands/keys.rb#285
  def keys(pattern = T.unsafe(nil)); end

  # Transfer a key from the connected instance to another instance.
  #
  # @param key [String, Array<String>]
  # @param options [Hash] - `:host => String`: host of instance to migrate to
  #   - `:port => Integer`: port of instance to migrate to
  #   - `:db => Integer`: database to migrate to (default: same as source)
  #   - `:timeout => Integer`: timeout (default: same as connection timeout)
  #   - `:copy => Boolean`: Do not remove the key from the local instance.
  #   - `:replace => Boolean`: Replace existing key on the remote instance.
  # @return [String] `"OK"`
  #
  # source://redis//lib/redis/commands/keys.rb#230
  def migrate(key, options); end

  # Move a key to another database.
  #
  # @example Move a key to another database
  #   redis.set "foo", "bar"
  #   # => "OK"
  #   redis.move "foo", 2
  #   # => true
  #   redis.exists "foo"
  #   # => false
  #   redis.select 2
  #   # => "OK"
  #   redis.exists "foo"
  #   # => true
  #   redis.get "foo"
  #   # => "bar"
  # @param key [String]
  # @param db [Integer]
  # @return [Boolean] whether the key was moved or not
  #
  # source://redis//lib/redis/commands/keys.rb#314
  def move(key, db); end

  # source://redis//lib/redis/commands/keys.rb#351
  def object(*args); end

  # Remove the expiration from a key.
  #
  # @param key [String]
  # @return [Boolean] whether the timeout was removed or not
  #
  # source://redis//lib/redis/commands/keys.rb#64
  def persist(key); end

  # Set a key's time to live in milliseconds.
  #
  # @param key [String]
  # @param milliseconds [Integer] time to live
  # @param options [Hash] - `:nx => true`: Set expiry only when the key has no expiry.
  #   - `:xx => true`: Set expiry only when the key has an existing expiry.
  #   - `:gt => true`: Set expiry only when the new expiry is greater than current one.
  #   - `:lt => true`: Set expiry only when the new expiry is less than current one.
  # @return [Boolean] whether the timeout was set or not
  #
  # source://redis//lib/redis/commands/keys.rb#142
  def pexpire(key, milliseconds, nx: T.unsafe(nil), xx: T.unsafe(nil), gt: T.unsafe(nil), lt: T.unsafe(nil)); end

  # Set the expiration for a key as number of milliseconds from UNIX Epoch.
  #
  # @param key [String]
  # @param ms_unix_time [Integer] expiry time specified as number of milliseconds from UNIX Epoch.
  # @param options [Hash] - `:nx => true`: Set expiry only when the key has no expiry.
  #   - `:xx => true`: Set expiry only when the key has an existing expiry.
  #   - `:gt => true`: Set expiry only when the new expiry is greater than current one.
  #   - `:lt => true`: Set expiry only when the new expiry is less than current one.
  # @return [Boolean] whether the timeout was set or not
  #
  # source://redis//lib/redis/commands/keys.rb#162
  def pexpireat(key, ms_unix_time, nx: T.unsafe(nil), xx: T.unsafe(nil), gt: T.unsafe(nil), lt: T.unsafe(nil)); end

  # Get a key's expiry time specified as number of milliseconds from UNIX Epoch
  #
  # @param key [String]
  # @return [Integer] expiry time specified as number of milliseconds from UNIX Epoch
  #
  # source://redis//lib/redis/commands/keys.rb#176
  def pexpiretime(key); end

  # Get the time to live (in milliseconds) for a key.
  #
  # In Redis 2.6 or older the command returns -1 if the key does not exist or if
  # the key exist but has no associated expire.
  #
  # Starting with Redis 2.8 the return value in case of error changed:
  #
  #     - The command returns -2 if the key does not exist.
  #     - The command returns -1 if the key exists but has no associated expire.
  #
  # @param key [String]
  # @return [Integer] remaining time to live in milliseconds
  #
  # source://redis//lib/redis/commands/keys.rb#191
  def pttl(key); end

  # Return a random key from the keyspace.
  #
  # @return [String]
  #
  # source://redis//lib/redis/commands/keys.rb#358
  def randomkey; end

  # Rename a key. If the new key already exists it is overwritten.
  #
  # @param old_name [String]
  # @param new_name [String]
  # @return [String] `OK`
  #
  # source://redis//lib/redis/commands/keys.rb#367
  def rename(old_name, new_name); end

  # Rename a key, only if the new key does not exist.
  #
  # @param old_name [String]
  # @param new_name [String]
  # @return [Boolean] whether the key was renamed or not
  #
  # source://redis//lib/redis/commands/keys.rb#376
  def renamenx(old_name, new_name); end

  # Create a key using the serialized value, previously obtained using DUMP.
  #
  # @param key [String]
  # @param ttl [String]
  # @param serialized_value [String]
  # @param options [Hash] - `:replace => Boolean`: if false, raises an error if key already exists
  # @raise [Redis::CommandError]
  # @return [String] `"OK"`
  #
  # source://redis//lib/redis/commands/keys.rb#212
  def restore(key, ttl, serialized_value, replace: T.unsafe(nil)); end

  # Scan the keyspace
  #
  # @example Retrieve the first batch of keys
  #   redis.scan(0)
  #   # => ["4", ["key:21", "key:47", "key:42"]]
  # @example Retrieve a batch of keys matching a pattern
  #   redis.scan(4, :match => "key:1?")
  #   # => ["92", ["key:13", "key:18"]]
  # @example Retrieve a batch of keys of a certain type
  #   redis.scan(92, :type => "zset")
  #   # => ["173", ["sortedset:14", "sortedset:78"]]
  # @param cursor [String, Integer] the cursor of the iteration
  # @param options [Hash] - `:match => String`: only return keys matching the pattern
  #   - `:count => Integer`: return count keys at most per iteration
  #   - `:type => String`: return keys only of the given type
  # @return [String, Array<String>] the next cursor and all found keys
  #
  # source://redis//lib/redis/commands/keys.rb#25
  def scan(cursor, **options); end

  # Scan the keyspace
  #
  # @example Retrieve all of the keys (with possible duplicates)
  #   redis.scan_each.to_a
  #   # => ["key:21", "key:47", "key:42"]
  # @example Execute block for each key matching a pattern
  #   redis.scan_each(:match => "key:1?") {|key| puts key}
  #   # => key:13
  #   # => key:18
  # @example Execute block for each key of a type
  #   redis.scan_each(:type => "hash") {|key| puts redis.type(key)}
  #   # => "hash"
  #   # => "hash"
  # @param options [Hash] - `:match => String`: only return keys matching the pattern
  #   - `:count => Integer`: return count keys at most per iteration
  #   - `:type => String`: return keys only of the given type
  # @return [Enumerator] an enumerator for all found keys
  #
  # source://redis//lib/redis/commands/keys.rb#49
  def scan_each(**options, &block); end

  # Sort the elements in a list, set or sorted set.
  #
  # @example Retrieve the first 2 elements from an alphabetically sorted "list"
  #   redis.sort("list", :order => "alpha", :limit => [0, 2])
  #   # => ["a", "b"]
  # @example Store an alphabetically descending list in "target"
  #   redis.sort("list", :order => "desc alpha", :store => "target")
  #   # => 26
  # @param key [String]
  # @param options [Hash] - `:by => String`: use external key to sort elements by
  #   - `:limit => [offset, count]`: skip `offset` elements, return a maximum
  #   of `count` elements
  #   - `:get => [String, Array<String>]`: single key or array of keys to
  #   retrieve per element in the result
  #   - `:order => String`: combination of `ASC`, `DESC` and optionally `ALPHA`
  #   - `:store => String`: key to store the result at
  # @return [Array<String>, Array<Array<String>>, Integer] - when `:get` is not specified, or holds a single element, an array of elements
  #   - when `:get` is specified, and holds more than one element, an array of
  #   elements where every element is an array with the result for every
  #   element specified in `:get`
  #   - when `:store` is specified, the number of elements in the stored result
  #
  # source://redis//lib/redis/commands/keys.rb#405
  def sort(key, by: T.unsafe(nil), limit: T.unsafe(nil), get: T.unsafe(nil), order: T.unsafe(nil), store: T.unsafe(nil)); end

  # Get the time to live (in seconds) for a key.
  #
  # In Redis 2.6 or older the command returns -1 if the key does not exist or if
  # the key exist but has no associated expire.
  #
  # Starting with Redis 2.8 the return value in case of error changed:
  #
  #     - The command returns -2 if the key does not exist.
  #     - The command returns -1 if the key exists but has no associated expire.
  #
  # @param key [String]
  # @return [Integer] remaining time to live in seconds.
  #
  # source://redis//lib/redis/commands/keys.rb#128
  def ttl(key); end

  # Determine the type stored at key.
  #
  # @param key [String]
  # @return [String] `string`, `list`, `set`, `zset`, `hash` or `none`
  #
  # source://redis//lib/redis/commands/keys.rb#435
  def type(key); end

  # Unlink one or more keys.
  #
  # @param keys [String, Array<String>]
  # @return [Integer] number of keys that were unlinked
  #
  # source://redis//lib/redis/commands/keys.rb#259
  def unlink(*keys); end

  private

  # source://redis//lib/redis/commands/keys.rb#441
  def _scan(command, cursor, args, match: T.unsafe(nil), count: T.unsafe(nil), type: T.unsafe(nil), &block); end
end

# source://redis//lib/redis/commands/lists.rb#5
module Redis::Commands::Lists
  # Remove the first/last element in a list and append/prepend it
  # to another list and return it, or block until one is available.
  #
  # @example With timeout
  #   element = redis.blmove("foo", "bar", "LEFT", "RIGHT", timeout: 5)
  #   # => nil on timeout
  #   # => "element" on success
  # @example Without timeout
  #   element = redis.blmove("foo", "bar", "LEFT", "RIGHT")
  #   # => "element"
  # @param source [String] source key
  # @param destination [String] destination key
  # @param where_source [String, Symbol] from where to remove the element from the source list
  #   e.g. 'LEFT' - from head, 'RIGHT' - from tail
  # @param where_destination [String, Symbol] where to push the element to the source list
  #   e.g. 'LEFT' - to head, 'RIGHT' - to tail
  # @param options [Hash] - `:timeout => [Float, Integer]`: timeout in seconds, defaults to no timeout
  # @return [nil, String] the element, or nil when the source key does not exist or the timeout expired
  #
  # source://redis//lib/redis/commands/lists.rb#55
  def blmove(source, destination, where_source, where_destination, timeout: T.unsafe(nil)); end

  # Pops one or more elements from the first non-empty list key from the list
  # of provided key names. If lists are empty, blocks until timeout has passed.
  #
  # @example Popping a element
  #   redis.blmpop(1.0, 'list')
  #   #=> ['list', ['a']]
  # @example With count option
  #   redis.blmpop(1.0, 'list', count: 2)
  #   #=> ['list', ['a', 'b']]
  # @raise [ArgumentError]
  # @return [Array<String, Array<String, Float>>] list of popped elements or nil
  #
  # source://redis//lib/redis/commands/lists.rb#205
  def blmpop(timeout, *keys, modifier: T.unsafe(nil), count: T.unsafe(nil)); end

  # Remove and get the first element in a list, or block until one is available.
  #
  # @example With timeout
  #   list, element = redis.blpop("list", :timeout => 5)
  #   # => nil on timeout
  #   # => ["list", "element"] on success
  # @example Without timeout
  #   list, element = redis.blpop("list")
  #   # => ["list", "element"]
  # @example Blocking pop on multiple lists
  #   list, element = redis.blpop(["list", "another_list"])
  #   # => ["list", "element"]
  # @param keys [String, Array<String>] one or more keys to perform the
  #   blocking pop on
  # @param options [Hash] - `:timeout => [Float, Integer]`: timeout in seconds, defaults to no timeout
  # @return [nil, [String, String]] - `nil` when the operation timed out
  #   - tuple of the list that was popped from and element was popped otherwise
  #
  # source://redis//lib/redis/commands/lists.rb#150
  def blpop(*args); end

  # Remove and get the last element in a list, or block until one is available.
  #
  # @param keys [String, Array<String>] one or more keys to perform the
  #   blocking pop on
  # @param options [Hash] - `:timeout => [Float, Integer]`: timeout in seconds, defaults to no timeout
  # @return [nil, [String, String]] - `nil` when the operation timed out
  #   - tuple of the list that was popped from and element was popped otherwise
  # @see #blpop
  #
  # source://redis//lib/redis/commands/lists.rb#166
  def brpop(*args); end

  # Pop a value from a list, push it to another list and return it; or block
  # until one is available.
  #
  # @param source [String] source key
  # @param destination [String] destination key
  # @param options [Hash] - `:timeout => [Float, Integer]`: timeout in seconds, defaults to no timeout
  # @return [nil, String] - `nil` when the operation timed out
  #   - the element was popped and pushed otherwise
  #
  # source://redis//lib/redis/commands/lists.rb#181
  def brpoplpush(source, destination, timeout: T.unsafe(nil)); end

  # Get an element from a list by its index.
  #
  # @param key [String]
  # @param index [Integer]
  # @return [String]
  #
  # source://redis//lib/redis/commands/lists.rb#245
  def lindex(key, index); end

  # Insert an element before or after another element in a list.
  #
  # @param key [String]
  # @param where [String, Symbol] `BEFORE` or `AFTER`
  # @param pivot [String] reference element
  # @param value [String]
  # @return [Integer] length of the list after the insert operation, or `-1`
  #   when the element `pivot` was not found
  #
  # source://redis//lib/redis/commands/lists.rb#257
  def linsert(key, where, pivot, value); end

  # Get the length of a list.
  #
  # @param key [String]
  # @return [Integer]
  #
  # source://redis//lib/redis/commands/lists.rb#10
  def llen(key); end

  # Remove the first/last element in a list, append/prepend it to another list and return it.
  #
  # @note This command comes in place of the now deprecated RPOPLPUSH.
  #   Doing LMOVE RIGHT LEFT is equivalent.
  # @param source [String] source key
  # @param destination [String] destination key
  # @param where_source [String, Symbol] from where to remove the element from the source list
  #   e.g. 'LEFT' - from head, 'RIGHT' - from tail
  # @param where_destination [String, Symbol] where to push the element to the source list
  #   e.g. 'LEFT' - to head, 'RIGHT' - to tail
  # @return [nil, String] the element, or nil when the source key does not exist
  #
  # source://redis//lib/redis/commands/lists.rb#27
  def lmove(source, destination, where_source, where_destination); end

  # Pops one or more elements from the first non-empty list key from the list
  # of provided key names.
  #
  # @example Popping a element
  #   redis.lmpop('list')
  #   #=> ['list', ['a']]
  # @example With count option
  #   redis.lmpop('list', count: 2)
  #   #=> ['list', ['a', 'b']]
  # @raise [ArgumentError]
  # @return [Array<String, Array<String, Float>>] list of popped elements or nil
  #
  # source://redis//lib/redis/commands/lists.rb#231
  def lmpop(*keys, modifier: T.unsafe(nil), count: T.unsafe(nil)); end

  # Remove and get the first elements in a list.
  #
  # @param key [String]
  # @param count [Integer] number of elements to remove
  # @return [nil, String, Array<String>] the values of the first elements
  #
  # source://redis//lib/redis/commands/lists.rb#103
  def lpop(key, count = T.unsafe(nil)); end

  # Prepend one or more values to a list, creating the list if it doesn't exist
  #
  # @param key [String]
  # @param value [String, Array<String>] string value, or array of string values to push
  # @return [Integer] the length of the list after the push operation
  #
  # source://redis//lib/redis/commands/lists.rb#67
  def lpush(key, value); end

  # Prepend a value to a list, only if the list exists.
  #
  # @param key [String]
  # @param value [String]
  # @return [Integer] the length of the list after the push operation
  #
  # source://redis//lib/redis/commands/lists.rb#76
  def lpushx(key, value); end

  # Get a range of elements from a list.
  #
  # @param key [String]
  # @param start [Integer] start index
  # @param stop [Integer] stop index
  # @return [Array<String>]
  #
  # source://redis//lib/redis/commands/lists.rb#267
  def lrange(key, start, stop); end

  # Remove elements from a list.
  #
  # @param key [String]
  # @param count [Integer] number of elements to remove. Use a positive
  #   value to remove the first `count` occurrences of `value`. A negative
  #   value to remove the last `count` occurrences of `value`. Or zero, to
  #   remove all occurrences of `value` from the list.
  # @param value [String]
  # @return [Integer] the number of removed elements
  #
  # source://redis//lib/redis/commands/lists.rb#280
  def lrem(key, count, value); end

  # Set the value of an element in a list by its index.
  #
  # @param key [String]
  # @param index [Integer]
  # @param value [String]
  # @return [String] `OK`
  #
  # source://redis//lib/redis/commands/lists.rb#290
  def lset(key, index, value); end

  # Trim a list to the specified range.
  #
  # @param key [String]
  # @param start [Integer] start index
  # @param stop [Integer] stop index
  # @return [String] `OK`
  #
  # source://redis//lib/redis/commands/lists.rb#300
  def ltrim(key, start, stop); end

  # Remove and get the last elements in a list.
  #
  # @param key [String]
  # @param count [Integer] number of elements to remove
  # @return [nil, String, Array<String>] the values of the last elements
  #
  # source://redis//lib/redis/commands/lists.rb#114
  def rpop(key, count = T.unsafe(nil)); end

  # Remove the last element in a list, append it to another list and return it.
  #
  # @param source [String] source key
  # @param destination [String] destination key
  # @return [nil, String] the element, or nil when the source key does not exist
  #
  # source://redis//lib/redis/commands/lists.rb#125
  def rpoplpush(source, destination); end

  # Append one or more values to a list, creating the list if it doesn't exist
  #
  # @param key [String]
  # @param value [String, Array<String>] string value, or array of string values to push
  # @return [Integer] the length of the list after the push operation
  #
  # source://redis//lib/redis/commands/lists.rb#85
  def rpush(key, value); end

  # Append a value to a list, only if the list exists.
  #
  # @param key [String]
  # @param value [String]
  # @return [Integer] the length of the list after the push operation
  #
  # source://redis//lib/redis/commands/lists.rb#94
  def rpushx(key, value); end

  private

  # source://redis//lib/redis/commands/lists.rb#306
  def _bpop(cmd, args, &blk); end

  # source://redis//lib/redis/commands/lists.rb#323
  def _normalize_move_wheres(where_source, where_destination); end
end

# source://redis//lib/redis/commands.rb#192
Redis::Commands::Noop = T.let(T.unsafe(nil), Proc)

# source://redis//lib/redis/commands.rb#65
Redis::Commands::Pairify = T.let(T.unsafe(nil), Proc)

# source://redis//lib/redis/commands/pubsub.rb#5
module Redis::Commands::Pubsub
  # Listen for messages published to channels matching the given patterns.
  #
  # source://redis//lib/redis/commands/pubsub.rb#32
  def psubscribe(*channels, &block); end

  # Listen for messages published to channels matching the given patterns.
  # Throw a timeout error if there is no messages for a timeout period.
  #
  # source://redis//lib/redis/commands/pubsub.rb#38
  def psubscribe_with_timeout(timeout, *channels, &block); end

  # Post a message to a channel.
  #
  # source://redis//lib/redis/commands/pubsub.rb#7
  def publish(channel, message); end

  # Inspect the state of the Pub/Sub subsystem.
  # Possible subcommands: channels, numsub, numpat.
  #
  # source://redis//lib/redis/commands/pubsub.rb#49
  def pubsub(subcommand, *args); end

  # Stop listening for messages posted to channels matching the given patterns.
  #
  # source://redis//lib/redis/commands/pubsub.rb#43
  def punsubscribe(*channels); end

  # Post a message to a channel in a shard.
  #
  # source://redis//lib/redis/commands/pubsub.rb#54
  def spublish(channel, message); end

  # Listen for messages published to the given channels in a shard.
  #
  # source://redis//lib/redis/commands/pubsub.rb#59
  def ssubscribe(*channels, &block); end

  # Listen for messages published to the given channels in a shard.
  # Throw a timeout error if there is no messages for a timeout period.
  #
  # source://redis//lib/redis/commands/pubsub.rb#65
  def ssubscribe_with_timeout(timeout, *channels, &block); end

  # Listen for messages published to the given channels.
  #
  # source://redis//lib/redis/commands/pubsub.rb#16
  def subscribe(*channels, &block); end

  # Listen for messages published to the given channels. Throw a timeout error
  # if there is no messages for a timeout period.
  #
  # source://redis//lib/redis/commands/pubsub.rb#22
  def subscribe_with_timeout(timeout, *channels, &block); end

  # @return [Boolean]
  #
  # source://redis//lib/redis/commands/pubsub.rb#11
  def subscribed?; end

  # Stop listening for messages posted to the given channels in a shard.
  #
  # source://redis//lib/redis/commands/pubsub.rb#70
  def sunsubscribe(*channels); end

  # Stop listening for messages posted to the given channels.
  #
  # source://redis//lib/redis/commands/pubsub.rb#27
  def unsubscribe(*channels); end
end

# source://redis//lib/redis/commands/scripting.rb#5
module Redis::Commands::Scripting
  # Evaluate Lua script.
  #
  # @example EVAL without KEYS nor ARGV
  #   redis.eval("return 1")
  #   # => 1
  # @example EVAL with KEYS and ARGV as array arguments
  #   redis.eval("return { KEYS, ARGV }", ["k1", "k2"], ["a1", "a2"])
  #   # => [["k1", "k2"], ["a1", "a2"]]
  # @example EVAL with KEYS and ARGV in a hash argument
  #   redis.eval("return { KEYS, ARGV }", :keys => ["k1", "k2"], :argv => ["a1", "a2"])
  #   # => [["k1", "k2"], ["a1", "a2"]]
  # @param keys [Array<String>] optional array with keys to pass to the script
  # @param argv [Array<String>] optional array with arguments to pass to the script
  # @param options [Hash] - `:keys => Array<String>`: optional array with keys to pass to the script
  #   - `:argv => Array<String>`: optional array with arguments to pass to the script
  # @return depends on the script
  # @see #script
  # @see #evalsha
  #
  # source://redis//lib/redis/commands/scripting.rb#71
  def eval(*args); end

  # Evaluate Lua script by its SHA.
  #
  # @example EVALSHA without KEYS nor ARGV
  #   redis.evalsha(sha)
  #   # => <depends on script>
  # @example EVALSHA with KEYS and ARGV as array arguments
  #   redis.evalsha(sha, ["k1", "k2"], ["a1", "a2"])
  #   # => <depends on script>
  # @example EVALSHA with KEYS and ARGV in a hash argument
  #   redis.evalsha(sha, :keys => ["k1", "k2"], :argv => ["a1", "a2"])
  #   # => <depends on script>
  # @param keys [Array<String>] optional array with keys to pass to the script
  # @param argv [Array<String>] optional array with arguments to pass to the script
  # @param options [Hash] - `:keys => Array<String>`: optional array with keys to pass to the script
  #   - `:argv => Array<String>`: optional array with arguments to pass to the script
  # @return depends on the script
  # @see #script
  # @see #eval
  #
  # source://redis//lib/redis/commands/scripting.rb#96
  def evalsha(*args); end

  # Control remote script registry.
  #
  # @example Load a script
  #   sha = redis.script(:load, "return 1")
  #   # => <sha of this script>
  # @example Check if a script exists
  #   redis.script(:exists, sha)
  #   # => true
  # @example Check if multiple scripts exist
  #   redis.script(:exists, [sha, other_sha])
  #   # => [true, false]
  # @example Flush the script registry
  #   redis.script(:flush)
  #   # => "OK"
  # @example Kill a running script
  #   redis.script(:kill)
  #   # => "OK"
  # @param subcommand [String] e.g. `exists`, `flush`, `load`, `kill`
  # @param args [Array<String>] depends on subcommand
  # @return [String, Boolean, Array<Boolean>, ...] depends on subcommand
  # @see #eval
  # @see #evalsha
  #
  # source://redis//lib/redis/commands/scripting.rb#30
  def script(subcommand, *args); end

  private

  # source://redis//lib/redis/commands/scripting.rb#102
  def _eval(cmd, args); end
end

# source://redis//lib/redis/commands/server.rb#5
module Redis::Commands::Server
  # Asynchronously rewrite the append-only file.
  #
  # @return [String] `OK`
  #
  # source://redis//lib/redis/commands/server.rb#9
  def bgrewriteaof; end

  # Asynchronously save the dataset to disk.
  #
  # @return [String] `OK`
  #
  # source://redis//lib/redis/commands/server.rb#16
  def bgsave; end

  # Manage client connections.
  #
  # @param subcommand [String, Symbol] e.g. `kill`, `list`, `getname`, `setname`
  # @return [String, Hash] depends on subcommand
  #
  # source://redis//lib/redis/commands/server.rb#39
  def client(subcommand, *args); end

  # Get or set server configuration parameters.
  #
  # @param action [Symbol] e.g. `:get`, `:set`, `:resetstat`
  # @return [String, Hash] string reply, or hash when retrieving more than one
  #   property with `CONFIG GET`
  #
  # source://redis//lib/redis/commands/server.rb#25
  def config(action, *args); end

  # Return the number of keys in the selected database.
  #
  # @return [Integer]
  #
  # source://redis//lib/redis/commands/server.rb#55
  def dbsize; end

  # source://redis//lib/redis/commands/server.rb#183
  def debug(*args); end

  # Remove all keys from all databases.
  #
  # @param options [Hash] - `:async => Boolean`: async flush (default: false)
  # @return [String] `OK`
  #
  # source://redis//lib/redis/commands/server.rb#64
  def flushall(options = T.unsafe(nil)); end

  # Remove all keys from the current database.
  #
  # @param options [Hash] - `:async => Boolean`: async flush (default: false)
  # @return [String] `OK`
  #
  # source://redis//lib/redis/commands/server.rb#77
  def flushdb(options = T.unsafe(nil)); end

  # Get information and statistics about the server.
  #
  # @param cmd [String, Symbol] e.g. "commandstats"
  # @return [Hash<String, String>]
  #
  # source://redis//lib/redis/commands/server.rb#89
  def info(cmd = T.unsafe(nil)); end

  # Get the UNIX time stamp of the last successful save to disk.
  #
  # @return [Integer]
  #
  # source://redis//lib/redis/commands/server.rb#110
  def lastsave; end

  # Listen for all requests received by the server in real time.
  #
  # There is no way to interrupt this command.
  #
  # @yield a block to be called for every line of output
  # @yieldparam line [String] timestamp and command that was executed
  #
  # source://redis//lib/redis/commands/server.rb#120
  def monitor; end

  # Synchronously save the dataset to disk.
  #
  # @return [String]
  #
  # source://redis//lib/redis/commands/server.rb#133
  def save; end

  # Synchronously save the dataset to disk and then shut down the server.
  #
  # source://redis//lib/redis/commands/server.rb#138
  def shutdown; end

  # Make the server a slave of another instance, or promote it as master.
  #
  # source://redis//lib/redis/commands/server.rb#150
  def slaveof(host, port); end

  # Interact with the slowlog (get, len, reset)
  #
  # @param subcommand [String] e.g. `get`, `len`, `reset`
  # @param length [Integer] maximum number of entries to return
  # @return [Array<String>, Integer, String] depends on subcommand
  #
  # source://redis//lib/redis/commands/server.rb#159
  def slowlog(subcommand, length = T.unsafe(nil)); end

  # Internal command used for replication.
  #
  # source://redis//lib/redis/commands/server.rb#166
  def sync; end

  # Return the server time.
  #
  # @example
  #   r.time # => [ 1333093196, 606806 ]
  # @return [Array<Integer>] tuple of seconds since UNIX epoch and
  #   microseconds in the current second
  #
  # source://redis//lib/redis/commands/server.rb#177
  def time; end
end

# source://redis//lib/redis/commands/sets.rb#5
module Redis::Commands::Sets
  # Add one or more members to a set.
  #
  # @param key [String]
  # @param member [String, Array<String>] one member, or array of members
  # @return [Integer] The number of members that were successfully added
  #
  # source://redis//lib/redis/commands/sets.rb#19
  def sadd(key, *members); end

  # Add one or more members to a set.
  #
  # @param key [String]
  # @param member [String, Array<String>] one member, or array of members
  # @return [Boolean] Wether at least one member was successfully added.
  #
  # source://redis//lib/redis/commands/sets.rb#29
  def sadd?(key, *members); end

  # Get the number of members in a set.
  #
  # @param key [String]
  # @return [Integer]
  #
  # source://redis//lib/redis/commands/sets.rb#10
  def scard(key); end

  # Subtract multiple sets.
  #
  # @param keys [String, Array<String>] keys pointing to sets to subtract
  # @return [Array<String>] members in the difference
  #
  # source://redis//lib/redis/commands/sets.rb#123
  def sdiff(*keys); end

  # Subtract multiple sets and store the resulting set in a key.
  #
  # @param destination [String] destination key
  # @param keys [String, Array<String>] keys pointing to sets to subtract
  # @return [Integer] number of elements in the resulting set
  #
  # source://redis//lib/redis/commands/sets.rb#133
  def sdiffstore(destination, *keys); end

  # Intersect multiple sets.
  #
  # @param keys [String, Array<String>] keys pointing to sets to intersect
  # @return [Array<String>] members in the intersection
  #
  # source://redis//lib/redis/commands/sets.rb#142
  def sinter(*keys); end

  # Intersect multiple sets and store the resulting set in a key.
  #
  # @param destination [String] destination key
  # @param keys [String, Array<String>] keys pointing to sets to intersect
  # @return [Integer] number of elements in the resulting set
  #
  # source://redis//lib/redis/commands/sets.rb#152
  def sinterstore(destination, *keys); end

  # Determine if a given value is a member of a set.
  #
  # @param key [String]
  # @param member [String]
  # @return [Boolean]
  #
  # source://redis//lib/redis/commands/sets.rb#95
  def sismember(key, member); end

  # Get all the members in a set.
  #
  # @param key [String]
  # @return [Array<String>]
  #
  # source://redis//lib/redis/commands/sets.rb#115
  def smembers(key); end

  # Determine if multiple values are members of a set.
  #
  # @param key [String]
  # @param members [String, Array<String>]
  # @return [Array<Boolean>]
  #
  # source://redis//lib/redis/commands/sets.rb#104
  def smismember(key, *members); end

  # Move a member from one set to another.
  #
  # @param source [String] source key
  # @param destination [String] destination key
  # @param member [String] member to move from `source` to `destination`
  # @return [Boolean]
  #
  # source://redis//lib/redis/commands/sets.rb#86
  def smove(source, destination, member); end

  # Remove and return one or more random member from a set.
  #
  # @param key [String]
  # @param count [Integer]
  # @return [String]
  #
  # source://redis//lib/redis/commands/sets.rb#59
  def spop(key, count = T.unsafe(nil)); end

  # Get one or more random members from a set.
  #
  # @param key [String]
  # @param count [Integer]
  # @return [String]
  #
  # source://redis//lib/redis/commands/sets.rb#72
  def srandmember(key, count = T.unsafe(nil)); end

  # Remove one or more members from a set.
  #
  # @param key [String]
  # @param member [String, Array<String>] one member, or array of members
  # @return [Integer] The number of members that were successfully removed
  #
  # source://redis//lib/redis/commands/sets.rb#39
  def srem(key, *members); end

  # Remove one or more members from a set.
  #
  # @param key [String]
  # @param member [String, Array<String>] one member, or array of members
  # @return [Boolean] Wether at least one member was successfully removed.
  #
  # source://redis//lib/redis/commands/sets.rb#49
  def srem?(key, *members); end

  # Scan a set
  #
  # @example Retrieve the first batch of keys in a set
  #   redis.sscan("set", 0)
  # @param cursor [String, Integer] the cursor of the iteration
  # @param options [Hash] - `:match => String`: only return keys matching the pattern
  #   - `:count => Integer`: return count keys at most per iteration
  # @return [String, Array<String>] the next cursor and all found members
  #
  # source://redis//lib/redis/commands/sets.rb#187
  def sscan(key, cursor, **options); end

  # Scan a set
  #
  # @example Retrieve all of the keys in a set
  #   redis.sscan_each("set").to_a
  #   # => ["key1", "key2", "key3"]
  # @param options [Hash] - `:match => String`: only return keys matching the pattern
  #   - `:count => Integer`: return count keys at most per iteration
  # @return [Enumerator] an enumerator for all keys in the set
  #
  # source://redis//lib/redis/commands/sets.rb#202
  def sscan_each(key, **options, &block); end

  # Add multiple sets.
  #
  # @param keys [String, Array<String>] keys pointing to sets to unify
  # @return [Array<String>] members in the union
  #
  # source://redis//lib/redis/commands/sets.rb#161
  def sunion(*keys); end

  # Add multiple sets and store the resulting set in a key.
  #
  # @param destination [String] destination key
  # @param keys [String, Array<String>] keys pointing to sets to unify
  # @return [Integer] number of elements in the resulting set
  #
  # source://redis//lib/redis/commands/sets.rb#171
  def sunionstore(destination, *keys); end
end

# source://redis//lib/redis/commands/sorted_sets.rb#5
module Redis::Commands::SortedSets
  # Removes and returns up to count members with scores in the sorted set stored at key.
  #
  # @example Popping a member
  #   redis.bzmpop('zset')
  #   #=> ['zset', ['a', 1.0]]
  # @example With count option
  #   redis.bzmpop('zset', count: 2)
  #   #=> ['zset', [['a', 1.0], ['b', 2.0]]
  # @raise [ArgumentError]
  # @return [Array<String, Array<String, Float>>] list of popped elements and scores
  #
  # source://redis//lib/redis/commands/sorted_sets.rb#188
  def bzmpop(timeout, *keys, modifier: T.unsafe(nil), count: T.unsafe(nil)); end

  # Removes and returns up to count members with the highest scores in the sorted set stored at keys,
  #   or block until one is available.
  #
  # @example Popping a member from a sorted set
  #   redis.bzpopmax('zset', 1)
  #   #=> ['zset', 'b', 2.0]
  # @example Popping a member from multiple sorted sets
  #   redis.bzpopmax('zset1', 'zset2', 1)
  #   #=> ['zset1', 'b', 2.0]
  # @return [Array<String, String, Float>] a touple of key, member and score
  # @return [nil] when no element could be popped and the timeout expired
  #
  # source://redis//lib/redis/commands/sorted_sets.rb#251
  def bzpopmax(*args); end

  # Removes and returns up to count members with the lowest scores in the sorted set stored at keys,
  #   or block until one is available.
  #
  # @example Popping a member from a sorted set
  #   redis.bzpopmin('zset', 1)
  #   #=> ['zset', 'a', 1.0]
  # @example Popping a member from multiple sorted sets
  #   redis.bzpopmin('zset1', 'zset2', 1)
  #   #=> ['zset1', 'a', 1.0]
  # @return [Array<String, String, Float>] a touple of key, member and score
  # @return [nil] when no element could be popped and the timeout expired
  #
  # source://redis//lib/redis/commands/sorted_sets.rb#272
  def bzpopmin(*args); end

  # Add one or more members to a sorted set, or update the score for members
  # that already exist.
  #
  # @example Add a single `[score, member]` pair to a sorted set
  #   redis.zadd("zset", 32.0, "member")
  # @example Add an array of `[score, member]` pairs to a sorted set
  #   redis.zadd("zset", [[32.0, "a"], [64.0, "b"]])
  # @param key [String]
  # @param args [[Float, String], Array<[Float, String]>] - a single `[score, member]` pair
  #   - an array of `[score, member]` pairs
  # @param options [Hash] - `:xx => true`: Only update elements that already exist (never
  #   add elements)
  #   - `:nx => true`: Don't update already existing elements (always
  #   add new elements)
  #   - `:lt => true`: Only update existing elements if the new score
  #   is less than the current score
  #   - `:gt => true`: Only update existing elements if the new score
  #   is greater than the current score
  #   - `:ch => true`: Modify the return value from the number of new
  #   elements added, to the total number of elements changed (CH is an
  #   abbreviation of changed); changed elements are new elements added
  #   and elements already existing for which the score was updated
  #   - `:incr => true`: When this option is specified ZADD acts like
  #   ZINCRBY; only one score-element pair can be specified in this mode
  # @return [Boolean, Integer, Float] - `Boolean` when a single pair is specified, holding whether or not it was
  #   **added** to the sorted set.
  #   - `Integer` when an array of pairs is specified, holding the number of
  #   pairs that were **added** to the sorted set.
  #   - `Float` when option :incr is specified, holding the score of the member
  #   after incrementing it.
  #
  # source://redis//lib/redis/commands/sorted_sets.rb#53
  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

  # Get the number of members in a sorted set.
  #
  # @example
  #   redis.zcard("zset")
  #   # => 4
  # @param key [String]
  # @return [Integer]
  #
  # source://redis//lib/redis/commands/sorted_sets.rb#14
  def zcard(key); end

  # Count the members in a sorted set with scores within the given values.
  #
  # @example Count members with score `>= 5` and `< 100`
  #   redis.zcount("zset", "5", "(100")
  #   # => 2
  # @example Count members with scores `> 5`
  #   redis.zcount("zset", "(5", "+inf")
  #   # => 2
  # @param key [String]
  # @param min [String] - inclusive minimum score is specified verbatim
  #   - exclusive minimum score is specified by prefixing `(`
  # @param max [String] - inclusive maximum score is specified verbatim
  #   - exclusive maximum score is specified by prefixing `(`
  # @return [Integer] number of members in within the specified range
  #
  # source://redis//lib/redis/commands/sorted_sets.rb#678
  def zcount(key, min, max); end

  # Return the difference between the first and all successive input sorted sets
  #
  # @example
  #   redis.zadd("zsetA", [[1.0, "v1"], [2.0, "v2"]])
  #   redis.zadd("zsetB", [[3.0, "v2"], [2.0, "v3"]])
  #   redis.zdiff("zsetA", "zsetB")
  #   => ["v1"]
  # @example With scores
  #   redis.zadd("zsetA", [[1.0, "v1"], [2.0, "v2"]])
  #   redis.zadd("zsetB", [[3.0, "v2"], [2.0, "v3"]])
  #   redis.zdiff("zsetA", "zsetB", :with_scores => true)
  #   => [["v1", 1.0]]
  # @param keys [String, Array<String>] one or more keys to compute the difference
  # @param options [Hash] - `:with_scores => true`: include scores in output
  # @return [Array<String>, Array<[String, Float]>] - when `:with_scores` is not specified, an array of members
  #   - when `:with_scores` is specified, an array with `[member, score]` pairs
  #
  # source://redis//lib/redis/commands/sorted_sets.rb#787
  def zdiff(*keys, with_scores: T.unsafe(nil)); end

  # Compute the difference between the first and all successive input sorted sets
  # and store the resulting sorted set in a new key
  #
  # @example
  #   redis.zadd("zsetA", [[1.0, "v1"], [2.0, "v2"]])
  #   redis.zadd("zsetB", [[3.0, "v2"], [2.0, "v3"]])
  #   redis.zdiffstore("zsetA", "zsetB")
  #   # => 1
  # @param destination [String] destination key
  # @param keys [Array<String>] source keys
  # @return [Integer] number of elements in the resulting sorted set
  #
  # source://redis//lib/redis/commands/sorted_sets.rb#803
  def zdiffstore(*args, **_arg1); end

  # Increment the score of a member in a sorted set.
  #
  # @example
  #   redis.zincrby("zset", 32.0, "a")
  #   # => 64.0
  # @param key [String]
  # @param increment [Float]
  # @param member [String]
  # @return [Float] score of the member after incrementing it
  #
  # source://redis//lib/redis/commands/sorted_sets.rb#86
  def zincrby(key, increment, member); end

  # Return the intersection of multiple sorted sets
  #
  # @example Retrieve the intersection of `2*zsetA` and `1*zsetB`
  #   redis.zinter("zsetA", "zsetB", :weights => [2.0, 1.0])
  #   # => ["v1", "v2"]
  # @example Retrieve the intersection of `2*zsetA` and `1*zsetB`, and their scores
  #   redis.zinter("zsetA", "zsetB", :weights => [2.0, 1.0], :with_scores => true)
  #   # => [["v1", 3.0], ["v2", 6.0]]
  # @param keys [String, Array<String>] one or more keys to intersect
  # @param options [Hash] - `:weights => [Float, Float, ...]`: weights to associate with source
  #   sorted sets
  #   - `:aggregate => String`: aggregate function to use (sum, min, max, ...)
  #   - `:with_scores => true`: include scores in output
  # @return [Array<String>, Array<[String, Float]>] - when `:with_scores` is not specified, an array of members
  #   - when `:with_scores` is specified, an array with `[member, score]` pairs
  #
  # source://redis//lib/redis/commands/sorted_sets.rb#701
  def zinter(*args, **_arg1); end

  # Intersect multiple sorted sets and store the resulting sorted set in a new
  # key.
  #
  # @example Compute the intersection of `2*zsetA` with `1*zsetB`, summing their scores
  #   redis.zinterstore("zsetC", ["zsetA", "zsetB"], :weights => [2.0, 1.0], :aggregate => "sum")
  #   # => 4
  # @param destination [String] destination key
  # @param keys [Array<String>] source keys
  # @param options [Hash] - `:weights => [Array<Float>]`: weights to associate with source
  #   sorted sets
  #   - `:aggregate => String`: aggregate function to use (sum, min, max)
  # @return [Integer] number of elements in the resulting sorted set
  #
  # source://redis//lib/redis/commands/sorted_sets.rb#720
  def zinterstore(*args, **_arg1); end

  # Count the members, with the same score in a sorted set, within the given lexicographical range.
  #
  # @example Count members matching a
  #   redis.zlexcount("zset", "[a", "[a\xff")
  #   # => 1
  # @example Count members matching a-z
  #   redis.zlexcount("zset", "[a", "[z\xff")
  #   # => 26
  # @param key [String]
  # @param min [String] - inclusive minimum is specified by prefixing `(`
  #   - exclusive minimum is specified by prefixing `[`
  # @param max [String] - inclusive maximum is specified by prefixing `(`
  #   - exclusive maximum is specified by prefixing `[`
  # @return [Integer] number of members within the specified lexicographical range
  #
  # source://redis//lib/redis/commands/sorted_sets.rb#509
  def zlexcount(key, min, max); end

  # Removes and returns up to count members with scores in the sorted set stored at key.
  #
  # @example Popping a member
  #   redis.zmpop('zset')
  #   #=> ['zset', ['a', 1.0]]
  # @example With count option
  #   redis.zmpop('zset', count: 2)
  #   #=> ['zset', [['a', 1.0], ['b', 2.0]]
  # @raise [ArgumentError]
  # @return [Array<String, Array<String, Float>>] list of popped elements and scores
  #
  # source://redis//lib/redis/commands/sorted_sets.rb#220
  def zmpop(*keys, modifier: T.unsafe(nil), count: T.unsafe(nil)); end

  # Get the scores associated with the given members in a sorted set.
  #
  # @example Get the scores for members "a" and "b"
  #   redis.zmscore("zset", "a", "b")
  #   # => [32.0, 48.0]
  # @param key [String]
  # @param members [String, Array<String>]
  # @return [Array<Float>] scores of the members
  #
  # source://redis//lib/redis/commands/sorted_sets.rb#300
  def zmscore(key, *members); end

  # Removes and returns up to count members with the highest scores in the sorted set stored at key.
  #
  # @example Popping a member
  #   redis.zpopmax('zset')
  #   #=> ['b', 2.0]
  # @example With count option
  #   redis.zpopmax('zset', 2)
  #   #=> [['b', 2.0], ['a', 1.0]]
  # @return [Array<String, Float>] element and score pair if count is not specified
  # @return [Array<Array<String, Float>>] list of popped elements and scores
  #
  # source://redis//lib/redis/commands/sorted_sets.rb#138
  def zpopmax(key, count = T.unsafe(nil)); end

  # Removes and returns up to count members with the lowest scores in the sorted set stored at key.
  #
  # @example Popping a member
  #   redis.zpopmin('zset')
  #   #=> ['a', 1.0]
  # @example With count option
  #   redis.zpopmin('zset', 2)
  #   #=> [['a', 1.0], ['b', 2.0]]
  # @return [Array<String, Float>] element and score pair if count is not specified
  # @return [Array<Array<String, Float>>] list of popped elements and scores
  #
  # source://redis//lib/redis/commands/sorted_sets.rb#161
  def zpopmin(key, count = T.unsafe(nil)); end

  # Get one or more random members from a sorted set.
  #
  # @example Get one random member
  #   redis.zrandmember("zset")
  #   # => "a"
  # @example Get multiple random members
  #   redis.zrandmember("zset", 2)
  #   # => ["a", "b"]
  # @example Get multiple random members with scores
  #   redis.zrandmember("zset", 2, with_scores: true)
  #   # => [["a", 2.0], ["b", 3.0]]
  # @param key [String]
  # @param count [Integer]
  # @param options [Hash] - `:with_scores => true`: include scores in output
  # @return [nil, String, Array<String>, Array<[String, Float]>] - when `key` does not exist or set is empty, `nil`
  #   - when `count` is not specified, a member
  #   - when `count` is specified and `:with_scores` is not specified, an array of members
  #   - when `:with_scores` is specified, an array with `[member, score]` pairs
  #
  # source://redis//lib/redis/commands/sorted_sets.rb#328
  def zrandmember(key, count = T.unsafe(nil), withscores: T.unsafe(nil), with_scores: T.unsafe(nil)); end

  # Return a range of members in a sorted set, by index, score or lexicographical ordering.
  #
  # @example Retrieve all members from a sorted set, by index
  #   redis.zrange("zset", 0, -1)
  #   # => ["a", "b"]
  # @example Retrieve all members and their scores from a sorted set
  #   redis.zrange("zset", 0, -1, :with_scores => true)
  #   # => [["a", 32.0], ["b", 64.0]]
  # @param key [String]
  # @param start [Integer] start index
  # @param stop [Integer] stop index
  # @param options [Hash] - `:by_score => false`: return members by score
  #   - `:by_lex => false`: return members by lexicographical ordering
  #   - `:rev => false`: reverse the ordering, from highest to lowest
  #   - `:limit => [offset, count]`: skip `offset` members, return a maximum of
  #   `count` members
  #   - `:with_scores => true`: include scores in output
  # @return [Array<String>, Array<[String, Float]>] - when `:with_scores` is not specified, an array of members
  #   - when `:with_scores` is specified, an array with `[member, score]` pairs
  #
  # source://redis//lib/redis/commands/sorted_sets.rb#367
  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

  # Return a range of members with the same score in a sorted set, by lexicographical ordering
  #
  # @example Retrieve members matching a
  #   redis.zrangebylex("zset", "[a", "[a\xff")
  #   # => ["aaren", "aarika", "abagael", "abby"]
  # @example Retrieve the first 2 members matching a
  #   redis.zrangebylex("zset", "[a", "[a\xff", :limit => [0, 2])
  #   # => ["aaren", "aarika"]
  # @param key [String]
  # @param min [String] - inclusive minimum is specified by prefixing `(`
  #   - exclusive minimum is specified by prefixing `[`
  # @param max [String] - inclusive maximum is specified by prefixing `(`
  #   - exclusive maximum is specified by prefixing `[`
  # @param options [Hash] - `:limit => [offset, count]`: skip `offset` members, return a maximum of
  #   `count` members
  # @return [Array<String>, Array<[String, Float]>]
  #
  # source://redis//lib/redis/commands/sorted_sets.rb#534
  def zrangebylex(key, min, max, limit: T.unsafe(nil)); end

  # Return a range of members in a sorted set, by score.
  #
  # @example Retrieve members with score `>= 5` and `< 100`
  #   redis.zrangebyscore("zset", "5", "(100")
  #   # => ["a", "b"]
  # @example Retrieve the first 2 members with score `>= 0`
  #   redis.zrangebyscore("zset", "0", "+inf", :limit => [0, 2])
  #   # => ["a", "b"]
  # @example Retrieve members and their scores with scores `> 5`
  #   redis.zrangebyscore("zset", "(5", "+inf", :with_scores => true)
  #   # => [["a", 32.0], ["b", 64.0]]
  # @param key [String]
  # @param min [String] - inclusive minimum score is specified verbatim
  #   - exclusive minimum score is specified by prefixing `(`
  # @param max [String] - inclusive maximum score is specified verbatim
  #   - exclusive maximum score is specified by prefixing `(`
  # @param options [Hash] - `:with_scores => true`: include scores in output
  #   - `:limit => [offset, count]`: skip `offset` members, return a maximum of
  #   `count` members
  # @return [Array<String>, Array<[String, Float]>] - when `:with_scores` is not specified, an array of members
  #   - when `:with_scores` is specified, an array with `[member, score]` pairs
  #
  # source://redis//lib/redis/commands/sorted_sets.rb#594
  def zrangebyscore(key, min, max, withscores: T.unsafe(nil), with_scores: T.unsafe(nil), limit: T.unsafe(nil)); end

  # Select a range of members in a sorted set, by index, score or lexicographical ordering
  # and store the resulting sorted set in a new key.
  #
  # @example
  #   redis.zadd("foo", [[1.0, "s1"], [2.0, "s2"], [3.0, "s3"]])
  #   redis.zrangestore("bar", "foo", 0, 1)
  #   # => 2
  #   redis.zrange("bar", 0, -1)
  #   # => ["s1", "s2"]
  # @return [Integer] the number of elements in the resulting sorted set
  # @see #zrange
  #
  # source://redis//lib/redis/commands/sorted_sets.rb#409
  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

  # Determine the index of a member in a sorted set.
  #
  # @param key [String]
  # @param member [String]
  # @return [Integer]
  #
  # source://redis//lib/redis/commands/sorted_sets.rb#460
  def zrank(key, member); end

  # Remove one or more members from a sorted set.
  #
  # @example Remove a single member from a sorted set
  #   redis.zrem("zset", "a")
  # @example Remove an array of members from a sorted set
  #   redis.zrem("zset", ["a", "b"])
  # @param key [String]
  # @param member [String, Array<String>] - a single member
  #   - an array of members
  # @return [Boolean, Integer] - `Boolean` when a single member is specified, holding whether or not it
  #   was removed from the sorted set
  #   - `Integer` when an array of pairs is specified, holding the number of
  #   members that were removed to the sorted set
  #
  # source://redis//lib/redis/commands/sorted_sets.rb#107
  def zrem(key, member); end

  # Remove all members in a sorted set within the given indexes.
  #
  # @example Remove first 5 members
  #   redis.zremrangebyrank("zset", 0, 4)
  #   # => 5
  # @example Remove last 5 members
  #   redis.zremrangebyrank("zset", -5, -1)
  #   # => 5
  # @param key [String]
  # @param start [Integer] start index
  # @param stop [Integer] stop index
  # @return [Integer] number of members that were removed
  #
  # source://redis//lib/redis/commands/sorted_sets.rb#487
  def zremrangebyrank(key, start, stop); end

  # Remove all members in a sorted set within the given scores.
  #
  # @example Remove members with score `>= 5` and `< 100`
  #   redis.zremrangebyscore("zset", "5", "(100")
  #   # => 2
  # @example Remove members with scores `> 5`
  #   redis.zremrangebyscore("zset", "(5", "+inf")
  #   # => 2
  # @param key [String]
  # @param min [String] - inclusive minimum score is specified verbatim
  #   - exclusive minimum score is specified by prefixing `(`
  # @param max [String] - inclusive maximum score is specified verbatim
  #   - exclusive maximum score is specified by prefixing `(`
  # @return [Integer] number of members that were removed
  #
  # source://redis//lib/redis/commands/sorted_sets.rb#657
  def zremrangebyscore(key, min, max); end

  # Return a range of members in a sorted set, by index, with scores ordered
  # from high to low.
  #
  # @example Retrieve all members from a sorted set
  #   redis.zrevrange("zset", 0, -1)
  #   # => ["b", "a"]
  # @example Retrieve all members and their scores from a sorted set
  #   redis.zrevrange("zset", 0, -1, :with_scores => true)
  #   # => [["b", 64.0], ["a", 32.0]]
  # @see #zrange
  #
  # source://redis//lib/redis/commands/sorted_sets.rb#444
  def zrevrange(key, start, stop, withscores: T.unsafe(nil), with_scores: T.unsafe(nil)); end

  # Return a range of members with the same score in a sorted set, by reversed lexicographical ordering.
  # Apart from the reversed ordering, #zrevrangebylex is similar to #zrangebylex.
  #
  # @example Retrieve members matching a
  #   redis.zrevrangebylex("zset", "[a", "[a\xff")
  #   # => ["abbygail", "abby", "abagael", "aaren"]
  # @example Retrieve the last 2 members matching a
  #   redis.zrevrangebylex("zset", "[a", "[a\xff", :limit => [0, 2])
  #   # => ["abbygail", "abby"]
  # @see #zrangebylex
  #
  # source://redis//lib/redis/commands/sorted_sets.rb#556
  def zrevrangebylex(key, max, min, limit: T.unsafe(nil)); end

  # Return a range of members in a sorted set, by score, with scores ordered
  # from high to low.
  #
  # @example Retrieve members with score `< 100` and `>= 5`
  #   redis.zrevrangebyscore("zset", "(100", "5")
  #   # => ["b", "a"]
  # @example Retrieve the first 2 members with score `<= 0`
  #   redis.zrevrangebyscore("zset", "0", "-inf", :limit => [0, 2])
  #   # => ["b", "a"]
  # @example Retrieve members and their scores with scores `> 5`
  #   redis.zrevrangebyscore("zset", "+inf", "(5", :with_scores => true)
  #   # => [["b", 64.0], ["a", 32.0]]
  # @see #zrangebyscore
  #
  # source://redis//lib/redis/commands/sorted_sets.rb#624
  def zrevrangebyscore(key, max, min, withscores: T.unsafe(nil), with_scores: T.unsafe(nil), limit: T.unsafe(nil)); end

  # Determine the index of a member in a sorted set, with scores ordered from
  # high to low.
  #
  # @param key [String]
  # @param member [String]
  # @return [Integer]
  #
  # source://redis//lib/redis/commands/sorted_sets.rb#470
  def zrevrank(key, member); end

  # Scan a sorted set
  #
  # @example Retrieve the first batch of key/value pairs in a hash
  #   redis.zscan("zset", 0)
  # @param cursor [String, Integer] the cursor of the iteration
  # @param options [Hash] - `:match => String`: only return keys matching the pattern
  #   - `:count => Integer`: return count keys at most per iteration
  # @return [String, Array<[String, Float]>] the next cursor and all found
  #   members and scores
  #
  # source://redis//lib/redis/commands/sorted_sets.rb#820
  def zscan(key, cursor, **options); end

  # Scan a sorted set
  #
  # @example Retrieve all of the members/scores in a sorted set
  #   redis.zscan_each("zset").to_a
  #   # => [["key70", "70"], ["key80", "80"]]
  # @param options [Hash] - `:match => String`: only return keys matching the pattern
  #   - `:count => Integer`: return count keys at most per iteration
  # @return [Enumerator] an enumerator for all found scores and members
  #
  # source://redis//lib/redis/commands/sorted_sets.rb#837
  def zscan_each(key, **options, &block); end

  # Get the score associated with the given member in a sorted set.
  #
  # @example Get the score for member "a"
  #   redis.zscore("zset", "a")
  #   # => 32.0
  # @param key [String]
  # @param member [String]
  # @return [Float] score of the member
  #
  # source://redis//lib/redis/commands/sorted_sets.rb#287
  def zscore(key, member); end

  # Return the union of multiple sorted sets
  #
  # @example Retrieve the union of `2*zsetA` and `1*zsetB`
  #   redis.zunion("zsetA", "zsetB", :weights => [2.0, 1.0])
  #   # => ["v1", "v2"]
  # @example Retrieve the union of `2*zsetA` and `1*zsetB`, and their scores
  #   redis.zunion("zsetA", "zsetB", :weights => [2.0, 1.0], :with_scores => true)
  #   # => [["v1", 3.0], ["v2", 6.0]]
  # @param keys [String, Array<String>] one or more keys to union
  # @param options [Hash] - `:weights => [Array<Float>]`: weights to associate with source
  #   sorted sets
  #   - `:aggregate => String`: aggregate function to use (sum, min, max)
  #   - `:with_scores => true`: include scores in output
  # @return [Array<String>, Array<[String, Float]>] - when `:with_scores` is not specified, an array of members
  #   - when `:with_scores` is specified, an array with `[member, score]` pairs
  #
  # source://redis//lib/redis/commands/sorted_sets.rb#744
  def zunion(*args, **_arg1); end

  # Add multiple sorted sets and store the resulting sorted set in a new key.
  #
  # @example Compute the union of `2*zsetA` with `1*zsetB`, summing their scores
  #   redis.zunionstore("zsetC", ["zsetA", "zsetB"], :weights => [2.0, 1.0], :aggregate => "sum")
  #   # => 8
  # @param destination [String] destination key
  # @param keys [Array<String>] source keys
  # @param options [Hash] - `:weights => [Float, Float, ...]`: weights to associate with source
  #   sorted sets
  #   - `:aggregate => String`: aggregate function to use (sum, min, max, ...)
  # @return [Integer] number of elements in the resulting sorted set
  #
  # source://redis//lib/redis/commands/sorted_sets.rb#762
  def zunionstore(*args, **_arg1); end

  private

  # source://redis//lib/redis/commands/sorted_sets.rb#850
  def _zsets_operation(cmd, *keys, weights: T.unsafe(nil), aggregate: T.unsafe(nil), with_scores: T.unsafe(nil)); end

  # source://redis//lib/redis/commands/sorted_sets.rb#869
  def _zsets_operation_store(cmd, destination, keys, weights: T.unsafe(nil), aggregate: T.unsafe(nil)); end
end

# source://redis//lib/redis/commands/streams.rb#5
module Redis::Commands::Streams
  # Removes one or multiple entries from the pending entries list of a stream consumer group.
  #
  # @example With a entry id
  #   redis.xack('mystream', 'mygroup', '1526569495631-0')
  # @example With splatted entry ids
  #   redis.xack('mystream', 'mygroup', '0-1', '0-2')
  # @example With arrayed entry ids
  #   redis.xack('mystream', 'mygroup', %w[0-1 0-2])
  # @param key [String] the stream key
  # @param group [String] the consumer group name
  # @param ids [Array<String>] one or multiple entry ids
  # @return [Integer] the number of entries successfully acknowledged
  #
  # source://redis//lib/redis/commands/streams.rb#266
  def xack(key, group, *ids); end

  # Add new entry to the stream.
  #
  # @example Without options
  #   redis.xadd('mystream', f1: 'v1', f2: 'v2')
  # @example With options
  #   redis.xadd('mystream', { f1: 'v1', f2: 'v2' }, id: '0-0', maxlen: 1000, approximate: true, nomkstream: true)
  # @option opts
  # @option opts
  # @option opts
  # @option opts
  # @param key [String] the stream key
  # @param entry [Hash] one or multiple field-value pairs
  # @param opts [Hash] several options for `XADD` command
  # @return [String] the entry id
  #
  # source://redis//lib/redis/commands/streams.rb#49
  def xadd(key, entry, approximate: T.unsafe(nil), maxlen: T.unsafe(nil), nomkstream: T.unsafe(nil), id: T.unsafe(nil)); end

  # Transfers ownership of pending stream entries that match the specified criteria.
  #
  # @example Claim next pending message stuck > 5 minutes and mark as retry
  #   redis.xautoclaim('mystream', 'mygroup', 'consumer1', 3600000, '0-0')
  # @example Claim 50 next pending messages stuck > 5 minutes and mark as retry
  #   redis.xclaim('mystream', 'mygroup', 'consumer1', 3600000, '0-0', count: 50)
  # @example Claim next pending message stuck > 5 minutes and don't mark as retry
  #   redis.xclaim('mystream', 'mygroup', 'consumer1', 3600000, '0-0', justid: true)
  # @example Claim next pending message after this id stuck > 5 minutes and mark as retry
  #   redis.xautoclaim('mystream', 'mygroup', 'consumer1', 3600000, '1641321233-0')
  # @param key [String] the stream key
  # @param group [String] the consumer group name
  # @param consumer [String] the consumer name
  # @param min_idle_time [Integer] the number of milliseconds
  # @param start [String] entry id to start scanning from or 0-0 for everything
  # @param count [Integer] number of messages to claim (default 1)
  # @param justid [Boolean] whether to fetch just an array of entry ids or not.
  #   Does not increment retry count when true
  # @return [Hash{String => Hash}] the entries successfully claimed
  # @return [Array<String>] the entry ids successfully claimed if justid option is `true`
  #
  # source://redis//lib/redis/commands/streams.rb#336
  def xautoclaim(key, group, consumer, min_idle_time, start, count: T.unsafe(nil), justid: T.unsafe(nil)); end

  # Changes the ownership of a pending entry
  #
  # @example With splatted entry ids
  #   redis.xclaim('mystream', 'mygroup', 'consumer1', 3600000, '0-1', '0-2')
  # @example With arrayed entry ids
  #   redis.xclaim('mystream', 'mygroup', 'consumer1', 3600000, %w[0-1 0-2])
  # @example With idle option
  #   redis.xclaim('mystream', 'mygroup', 'consumer1', 3600000, %w[0-1 0-2], idle: 1000)
  # @example With time option
  #   redis.xclaim('mystream', 'mygroup', 'consumer1', 3600000, %w[0-1 0-2], time: 1542866959000)
  # @example With retrycount option
  #   redis.xclaim('mystream', 'mygroup', 'consumer1', 3600000, %w[0-1 0-2], retrycount: 10)
  # @example With force option
  #   redis.xclaim('mystream', 'mygroup', 'consumer1', 3600000, %w[0-1 0-2], force: true)
  # @example With justid option
  #   redis.xclaim('mystream', 'mygroup', 'consumer1', 3600000, %w[0-1 0-2], justid: true)
  # @option opts
  # @option opts
  # @option opts
  # @option opts
  # @option opts
  # @param key [String] the stream key
  # @param group [String] the consumer group name
  # @param consumer [String] the consumer name
  # @param min_idle_time [Integer] the number of milliseconds
  # @param ids [Array<String>] one or multiple entry ids
  # @param opts [Hash] several options for `XCLAIM` command
  # @return [Hash{String => Hash}] the entries successfully claimed
  # @return [Array<String>] the entry ids successfully claimed if justid option is `true`
  #
  # source://redis//lib/redis/commands/streams.rb#303
  def xclaim(key, group, consumer, min_idle_time, *ids, **opts); end

  # Delete entries by entry ids.
  #
  # @example With splatted entry ids
  #   redis.xdel('mystream', '0-1', '0-2')
  # @example With arrayed entry ids
  #   redis.xdel('mystream', ['0-1', '0-2'])
  # @param key [String] the stream key
  # @param ids [Array<String>] one or multiple entry ids
  # @return [Integer] the number of entries actually deleted
  #
  # source://redis//lib/redis/commands/streams.rb#106
  def xdel(key, *ids); end

  # Manages the consumer group of the stream.
  #
  # @example With `create` subcommand
  #   redis.xgroup(:create, 'mystream', 'mygroup', '$')
  # @example With `setid` subcommand
  #   redis.xgroup(:setid, 'mystream', 'mygroup', '$')
  # @example With `destroy` subcommand
  #   redis.xgroup(:destroy, 'mystream', 'mygroup')
  # @example With `delconsumer` subcommand
  #   redis.xgroup(:delconsumer, 'mystream', 'mygroup', 'consumer1')
  # @param subcommand [String] `create` `setid` `destroy` `delconsumer`
  # @param key [String] the stream key
  # @param group [String] the consumer group name
  # @param id_or_consumer [String] * the entry id or `$`, required if subcommand is `create` or `setid`
  #   * the consumer name, required if subcommand is `delconsumer`
  # @param mkstream [Boolean] whether to create an empty stream automatically or not
  # @return [String] `OK` if subcommand is `create` or `setid`
  # @return [Integer] effected count if subcommand is `destroy` or `delconsumer`
  #
  # source://redis//lib/redis/commands/streams.rb#214
  def xgroup(subcommand, key, group, id_or_consumer = T.unsafe(nil), mkstream: T.unsafe(nil)); end

  # Returns the stream information each subcommand.
  #
  # @example stream
  #   redis.xinfo(:stream, 'mystream')
  # @example groups
  #   redis.xinfo(:groups, 'mystream')
  # @example consumers
  #   redis.xinfo(:consumers, 'mystream', 'mygroup')
  # @param subcommand [String] e.g. `stream` `groups` `consumers`
  # @param key [String] the stream key
  # @param group [String] the consumer group name, required if subcommand is `consumers`
  # @return [Hash] information of the stream if subcommand is `stream`
  # @return [Array<Hash>] information of the consumer groups if subcommand is `groups`
  # @return [Array<Hash>] information of the consumers if subcommand is `consumers`
  #
  # source://redis//lib/redis/commands/streams.rb#22
  def xinfo(subcommand, key, group = T.unsafe(nil)); end

  # Returns the number of entries inside a stream.
  #
  # @example With key
  #   redis.xlen('mystream')
  # @param key [String] the stream key
  # @return [Integer] the number of entries
  #
  # source://redis//lib/redis/commands/streams.rb#165
  def xlen(key); end

  # Fetches not acknowledging pending entries
  #
  # @example With key and group
  #   redis.xpending('mystream', 'mygroup')
  # @example With range options
  #   redis.xpending('mystream', 'mygroup', '-', '+', 10)
  # @example With range and idle time options
  #   redis.xpending('mystream', 'mygroup', '-', '+', 10, idle: 9000)
  # @example With range and consumer options
  #   redis.xpending('mystream', 'mygroup', '-', '+', 10, 'consumer1')
  # @option opts
  # @param key [String] the stream key
  # @param group [String] the consumer group name
  # @param start [String] start first entry id of range
  # @param end [String] end   last entry id of range
  # @param count [Integer] count the number of entries as limit
  # @param consumer [String] the consumer name
  # @param opts [Hash] a customizable set of options
  # @return [Hash] the summary of pending entries
  # @return [Array<Hash>] the pending entries details if options were specified
  #
  # source://redis//lib/redis/commands/streams.rb#368
  def xpending(key, group, *args, idle: T.unsafe(nil)); end

  # Fetches entries of the stream in ascending order.
  #
  # @example Without options
  #   redis.xrange('mystream')
  # @example With a specific start
  #   redis.xrange('mystream', '0-1')
  # @example With a specific start and end
  #   redis.xrange('mystream', '0-1', '0-3')
  # @example With count options
  #   redis.xrange('mystream', count: 10)
  # @param key [String] the stream key
  # @param start [String] first entry id of range, default value is `-`
  # @param end [String] last entry id of range, default value is `+`
  # @param count [Integer] the number of entries as limit
  # @return [Array<Array<String, Hash>>] the ids and entries pairs
  #
  # source://redis//lib/redis/commands/streams.rb#128
  def xrange(key, start = T.unsafe(nil), range_end = T.unsafe(nil), count: T.unsafe(nil)); end

  # Fetches entries from one or multiple streams. Optionally blocking.
  #
  # @example With a key
  #   redis.xread('mystream', '0-0')
  # @example With multiple keys
  #   redis.xread(%w[mystream1 mystream2], %w[0-0 0-0])
  # @example With count option
  #   redis.xread('mystream', '0-0', count: 2)
  # @example With block option
  #   redis.xread('mystream', '$', block: 1000)
  # @param keys [Array<String>] one or multiple stream keys
  # @param ids [Array<String>] one or multiple entry ids
  # @param count [Integer] the number of entries as limit per stream
  # @param block [Integer] the number of milliseconds as blocking timeout
  # @return [Hash{String => Hash{String => Hash}}] the entries
  #
  # source://redis//lib/redis/commands/streams.rb#186
  def xread(keys, ids, count: T.unsafe(nil), block: T.unsafe(nil)); end

  # Fetches a subset of the entries from one or multiple streams related with the consumer group.
  # Optionally blocking.
  #
  # @example With a key
  #   redis.xreadgroup('mygroup', 'consumer1', 'mystream', '>')
  # @example With multiple keys
  #   redis.xreadgroup('mygroup', 'consumer1', %w[mystream1 mystream2], %w[> >])
  # @example With count option
  #   redis.xreadgroup('mygroup', 'consumer1', 'mystream', '>', count: 2)
  # @example With block option
  #   redis.xreadgroup('mygroup', 'consumer1', 'mystream', '>', block: 1000)
  # @example With noack option
  #   redis.xreadgroup('mygroup', 'consumer1', 'mystream', '>', noack: true)
  # @option opts
  # @option opts
  # @option opts
  # @param group [String] the consumer group name
  # @param consumer [String] the consumer name
  # @param keys [Array<String>] one or multiple stream keys
  # @param ids [Array<String>] one or multiple entry ids
  # @param opts [Hash] several options for `XREADGROUP` command
  # @return [Hash{String => Hash{String => Hash}}] the entries
  #
  # source://redis//lib/redis/commands/streams.rb#244
  def xreadgroup(group, consumer, keys, ids, count: T.unsafe(nil), block: T.unsafe(nil), noack: T.unsafe(nil)); end

  # Fetches entries of the stream in descending order.
  #
  # @example Without options
  #   redis.xrevrange('mystream')
  # @example With a specific end
  #   redis.xrevrange('mystream', '0-3')
  # @example With a specific end and start
  #   redis.xrevrange('mystream', '0-3', '0-1')
  # @example With count options
  #   redis.xrevrange('mystream', count: 10)
  # @param key [String] the stream key
  # @param end [String] first entry id of range, default value is `+`
  # @param start [String] last entry id of range, default value is `-`
  # @return [Array<Array<String, Hash>>] the ids and entries pairs
  #
  # source://redis//lib/redis/commands/streams.rb#151
  def xrevrange(key, range_end = T.unsafe(nil), start = T.unsafe(nil), count: T.unsafe(nil)); end

  # Trims older entries of the stream if needed.
  #
  # @example Without options
  #   redis.xtrim('mystream', 1000)
  # @example With options
  #   redis.xtrim('mystream', 1000, approximate: true)
  # @example With strategy
  #   redis.xtrim('mystream', '1-0', strategy: 'MINID')
  # @overload xtrim
  # @overload xtrim
  # @return [Integer] the number of entries actually deleted
  #
  # source://redis//lib/redis/commands/streams.rb#85
  def xtrim(key, len_or_id, strategy: T.unsafe(nil), approximate: T.unsafe(nil), limit: T.unsafe(nil)); end

  private

  # source://redis//lib/redis/commands/streams.rb#385
  def _xread(args, keys, ids, blocking_timeout_msec); end
end

# source://redis//lib/redis/commands/strings.rb#5
module Redis::Commands::Strings
  # Append a value to a key.
  #
  # @param key [String]
  # @param value [String] value to append
  # @return [Integer] length of the string after appending
  #
  # source://redis//lib/redis/commands/strings.rb#255
  def append(key, value); end

  # Decrement the integer value of a key by one.
  #
  # @example
  #   redis.decr("value")
  #   # => 4
  # @param key [String]
  # @return [Integer] value after decrementing it
  #
  # source://redis//lib/redis/commands/strings.rb#14
  def decr(key); end

  # Decrement the integer value of a key by the given number.
  #
  # @example
  #   redis.decrby("value", 5)
  #   # => 0
  # @param key [String]
  # @param decrement [Integer]
  # @return [Integer] value after decrementing it
  #
  # source://redis//lib/redis/commands/strings.rb#27
  def decrby(key, decrement); end

  # Get the value of a key.
  #
  # @param key [String]
  # @return [String]
  #
  # source://redis//lib/redis/commands/strings.rb#190
  def get(key); end

  # Get the value of key and delete the key. This command is similar to GET,
  # except for the fact that it also deletes the key on success.
  #
  # @param key [String]
  # @return [String] the old value stored in the key, or `nil` if the key
  #   did not exist
  #
  # source://redis//lib/redis/commands/strings.rb#275
  def getdel(key); end

  # Get the value of key and optionally set its expiration. GETEX is similar to
  # GET, but is a write command with additional options. When no options are
  # provided, GETEX behaves like GET.
  #
  # @param key [String]
  # @param options [Hash] - `:ex => Integer`: Set the specified expire time, in seconds.
  #   - `:px => Integer`: Set the specified expire time, in milliseconds.
  #   - `:exat => true`: Set the specified Unix time at which the key will
  #   expire, in seconds.
  #   - `:pxat => true`: Set the specified Unix time at which the key will
  #   expire, in milliseconds.
  #   - `:persist => true`: Remove the time to live associated with the key.
  # @return [String] The value of key, or nil when key does not exist.
  #
  # source://redis//lib/redis/commands/strings.rb#293
  def getex(key, ex: T.unsafe(nil), px: T.unsafe(nil), exat: T.unsafe(nil), pxat: T.unsafe(nil), persist: T.unsafe(nil)); end

  # Get a substring of the string stored at a key.
  #
  # @param key [String]
  # @param start [Integer] zero-based start offset
  # @param stop [Integer] zero-based end offset. Use -1 for representing
  #   the end of the string
  # @return [Integer] `0` or `1`
  #
  # source://redis//lib/redis/commands/strings.rb#246
  def getrange(key, start, stop); end

  # Set the string value of a key and return its old value.
  #
  # @param key [String]
  # @param value [String] value to replace the current value with
  # @return [String] the old value stored in the key, or `nil` if the key
  #   did not exist
  #
  # source://redis//lib/redis/commands/strings.rb#265
  def getset(key, value); end

  # Increment the integer value of a key by one.
  #
  # @example
  #   redis.incr("value")
  #   # => 6
  # @param key [String]
  # @return [Integer] value after incrementing it
  #
  # source://redis//lib/redis/commands/strings.rb#39
  def incr(key); end

  # Increment the integer value of a key by the given integer number.
  #
  # @example
  #   redis.incrby("value", 5)
  #   # => 10
  # @param key [String]
  # @param increment [Integer]
  # @return [Integer] value after incrementing it
  #
  # source://redis//lib/redis/commands/strings.rb#52
  def incrby(key, increment); end

  # Increment the numeric value of a key by the given float number.
  #
  # @example
  #   redis.incrbyfloat("value", 1.23)
  #   # => 1.23
  # @param key [String]
  # @param increment [Float]
  # @return [Float] value after incrementing it
  #
  # source://redis//lib/redis/commands/strings.rb#65
  def incrbyfloat(key, increment); end

  # Get the values of all the given keys.
  #
  # @example
  #   redis.mapped_mget("key1", "key2")
  #   # => { "key1" => "v1", "key2" => "v2" }
  # @param keys [Array<String>] array of keys
  # @return [Hash] a hash mapping the specified keys to their values
  # @see #mget
  #
  # source://redis//lib/redis/commands/strings.rb#219
  def mapped_mget(*keys); end

  # Set one or more values.
  #
  # @example
  #   redis.mapped_mset({ "f1" => "v1", "f2" => "v2" })
  #   # => "OK"
  # @param hash [Hash] keys mapping to values
  # @return [String] `"OK"`
  # @see #mset
  #
  # source://redis//lib/redis/commands/strings.rb#154
  def mapped_mset(hash); end

  # Set one or more values, only if none of the keys exist.
  #
  # @example
  #   redis.mapped_msetnx({ "key1" => "v1", "key2" => "v2" })
  #   # => true
  # @param hash [Hash] keys mapping to values
  # @return [Boolean] whether or not all values were set
  # @see #msetnx
  #
  # source://redis//lib/redis/commands/strings.rb#182
  def mapped_msetnx(hash); end

  # Get the values of all the given keys.
  #
  # @example
  #   redis.mget("key1", "key2")
  #   # => ["v1", "v2"]
  # @param keys [Array<String>]
  # @return [Array<String>] an array of values for the specified keys
  # @see #mapped_mget
  #
  # source://redis//lib/redis/commands/strings.rb#204
  def mget(*keys, &blk); end

  # Set one or more values.
  #
  # @example
  #   redis.mset("key1", "v1", "key2", "v2")
  #   # => "OK"
  # @param args [Array<String>] array of keys and values
  # @return [String] `"OK"`
  # @see #mapped_mset
  #
  # source://redis//lib/redis/commands/strings.rb#140
  def mset(*args); end

  # Set one or more values, only if none of the keys exist.
  #
  # @example
  #   redis.msetnx("key1", "v1", "key2", "v2")
  #   # => true
  # @param args [Array<String>] array of keys and values
  # @return [Boolean] whether or not all values were set
  # @see #mapped_msetnx
  #
  # source://redis//lib/redis/commands/strings.rb#168
  def msetnx(*args); end

  # Set the time to live in milliseconds of a key.
  #
  # @param key [String]
  # @param ttl [Integer]
  # @param value [String]
  # @return [String] `"OK"`
  #
  # source://redis//lib/redis/commands/strings.rb#117
  def psetex(key, ttl, value); end

  # Set the string value of a key.
  #
  # @param key [String]
  # @param value [String]
  # @param options [Hash] - `:ex => Integer`: Set the specified expire time, in seconds.
  #   - `:px => Integer`: Set the specified expire time, in milliseconds.
  #   - `:exat => Integer` : Set the specified Unix time at which the key will expire, in seconds.
  #   - `:pxat => Integer` : Set the specified Unix time at which the key will expire, in milliseconds.
  #   - `:nx => true`: Only set the key if it does not already exist.
  #   - `:xx => true`: Only set the key if it already exist.
  #   - `:keepttl => true`: Retain the time to live associated with the key.
  #   - `:get => true`: Return the old string stored at key, or nil if key did not exist.
  # @return [String, Boolean] `"OK"` or true, false if `:nx => true` or `:xx => true`
  #
  # source://redis//lib/redis/commands/strings.rb#83
  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

  # Set the time to live in seconds of a key.
  #
  # @param key [String]
  # @param ttl [Integer]
  # @param value [String]
  # @return [String] `"OK"`
  #
  # source://redis//lib/redis/commands/strings.rb#107
  def setex(key, ttl, value); end

  # Set the value of a key, only if the key does not exist.
  #
  # @param key [String]
  # @param value [String]
  # @return [Boolean] whether the key was set or not
  #
  # source://redis//lib/redis/commands/strings.rb#126
  def setnx(key, value); end

  # Overwrite part of a string at key starting at the specified offset.
  #
  # @param key [String]
  # @param offset [Integer] byte offset
  # @param value [String]
  # @return [Integer] length of the string after it was modified
  #
  # source://redis//lib/redis/commands/strings.rb#235
  def setrange(key, offset, value); end

  # Get the length of the value stored in a key.
  #
  # @param key [String]
  # @return [Integer] the length of the value stored in the key, or 0
  #   if the key does not exist
  #
  # source://redis//lib/redis/commands/strings.rb#309
  def strlen(key); end
end

# source://redis//lib/redis/commands/transactions.rb#5
module Redis::Commands::Transactions
  # Discard all commands issued after MULTI.
  #
  # @return [String] `"OK"`
  # @see #multi
  # @see #exec
  #
  # source://redis//lib/redis/commands/transactions.rb#110
  def discard; end

  # Execute all commands issued after MULTI.
  #
  # Only call this method when `#multi` was called **without** a block.
  #
  # @return [nil, Array<...>] - when commands were not executed, `nil`
  #   - when commands were executed, an array with their replies
  # @see #multi
  # @see #discard
  #
  # source://redis//lib/redis/commands/transactions.rb#100
  def exec; end

  # Mark the start of a transaction block.
  #
  # @example With a block
  #   redis.multi do |multi|
  #   multi.set("key", "value")
  #   multi.incr("counter")
  #   end # => ["OK", 6]
  # @return [Array<...>] - an array with replies
  # @see #watch
  # @see #unwatch
  # @yield [multi] the commands that are called inside this block are cached
  #   and written to the server upon returning from it
  # @yieldparam multi [Redis] `self`
  #
  # source://redis//lib/redis/commands/transactions.rb#23
  def multi; end

  # Forget about all watched keys.
  #
  # @return [String] `OK`
  # @see #watch
  # @see #multi
  #
  # source://redis//lib/redis/commands/transactions.rb#86
  def unwatch; end

  # Watch the given keys to determine execution of the MULTI/EXEC block.
  #
  # Using a block is optional, but is necessary for thread-safety.
  #
  # An `#unwatch` is automatically issued if an exception is raised within the
  # block that is a subclass of StandardError and is not a ConnectionError.
  #
  # @example With a block
  #   redis.watch("key") do
  #   if redis.get("key") == "some value"
  #   redis.multi do |multi|
  #   multi.set("key", "other value")
  #   multi.incr("counter")
  #   end
  #   else
  #   redis.unwatch
  #   end
  #   end
  #   # => ["OK", 6]
  # @example Without a block
  #   redis.watch("key")
  #   # => "OK"
  # @param keys [String, Array<String>] one or more keys to watch
  # @return [Object] if using a block, returns the return value of the block
  # @return [String] if not using a block, returns `OK`
  # @see #unwatch
  # @see #multi
  #
  # source://redis//lib/redis/commands/transactions.rb#61
  def watch(*keys); end
end

# soft-deprecated
# We added this back for older sidekiq releases
#
# source://redis//lib/redis.rb#27
module Redis::Connection
  class << self
    # source://redis//lib/redis.rb#29
    def drivers; end
  end
end

# Raised when connection to a Redis server is lost.
#
# source://redis//lib/redis/errors.rb#41
class Redis::ConnectionError < ::Redis::BaseConnectionError; end

# source://redis//lib/redis.rb#9
class Redis::Deprecated < ::StandardError; end

# source://redis//lib/redis/distributed.rb#6
class Redis::Distributed
  # @return [Distributed] a new instance of Distributed
  #
  # source://redis//lib/redis/distributed.rb#20
  def initialize(node_configs, options = T.unsafe(nil)); end

  # source://redis//lib/redis/distributed.rb#410
  def [](key); end

  # source://redis//lib/redis/distributed.rb#414
  def []=(key, value); end

  # source://redis//lib/redis/distributed.rb#476
  def _bpop(cmd, args); end

  # source://redis//lib/redis/distributed.rb#1038
  def _eval(cmd, args); end

  # source://redis//lib/redis/distributed.rb#41
  def add_node(options); end

  # Append a value to a key.
  #
  # source://redis//lib/redis/distributed.rb#378
  def append(key, value); end

  # Asynchronously save the dataset to disk.
  #
  # source://redis//lib/redis/distributed.rb#74
  def bgsave; end

  # Count the number of set bits in a range of the string value stored at key.
  #
  # source://redis//lib/redis/distributed.rb#383
  def bitcount(key, start = T.unsafe(nil), stop = T.unsafe(nil), scale: T.unsafe(nil)); end

  # Perform a bitwise operation between strings and store the resulting string in a key.
  #
  # source://redis//lib/redis/distributed.rb#388
  def bitop(operation, destkey, *keys); end

  # Return the position of the first bit set to 1 or 0 in a string.
  #
  # source://redis//lib/redis/distributed.rb#396
  def bitpos(key, bit, start = T.unsafe(nil), stop = T.unsafe(nil), scale: T.unsafe(nil)); end

  # Remove the first/last element in a list and append/prepend it
  # to another list and return it, or block until one is available.
  #
  # source://redis//lib/redis/distributed.rb#432
  def blmove(source, destination, where_source, where_destination, timeout: T.unsafe(nil)); end

  # Iterate over keys, blocking and removing elements from the first non empty liist found.
  #
  # source://redis//lib/redis/distributed.rb#556
  def blmpop(timeout, *keys, modifier: T.unsafe(nil), count: T.unsafe(nil)); end

  # Remove and get the first element in a list, or block until one is
  # available.
  #
  # source://redis//lib/redis/distributed.rb#495
  def blpop(*args); end

  # Remove and get the last element in a list, or block until one is
  # available.
  #
  # source://redis//lib/redis/distributed.rb#513
  def brpop(*args); end

  # Pop a value from a list, push it to another list and return it; or block
  # until one is available.
  #
  # source://redis//lib/redis/distributed.rb#519
  def brpoplpush(source, destination, **options); end

  # Iterate over keys, blocking and removing members from the first non empty sorted set found.
  #
  # source://redis//lib/redis/distributed.rb#722
  def bzmpop(timeout, *keys, modifier: T.unsafe(nil), count: T.unsafe(nil)); end

  # source://redis//lib/redis/distributed.rb#499
  def bzpopmax(*args); end

  # source://redis//lib/redis/distributed.rb#505
  def bzpopmin(*args); end

  # source://redis//lib/redis/distributed.rb#69
  def close; end

  # Copy a value from one key to another.
  #
  # source://redis//lib/redis/distributed.rb#226
  def copy(source, destination, **options); end

  # Return the number of keys in the selected database.
  #
  # source://redis//lib/redis/distributed.rb#79
  def dbsize; end

  # Decrement the integer value of a key by one.
  #
  # source://redis//lib/redis/distributed.rb#266
  def decr(key); end

  # Decrement the integer value of a key by the given number.
  #
  # source://redis//lib/redis/distributed.rb#271
  def decrby(key, decrement); end

  # Delete a key.
  #
  # source://redis//lib/redis/distributed.rb#179
  def del(*args); end

  # Discard all commands issued after MULTI.
  #
  # @raise [CannotDistribute]
  #
  # source://redis//lib/redis/distributed.rb#1005
  def discard; end

  # Return a serialized version of the value stored at a key.
  #
  # source://redis//lib/redis/distributed.rb#164
  def dump(key); end

  # source://redis//lib/redis/distributed.rb#1065
  def dup; end

  # Echo the given string.
  #
  # source://redis//lib/redis/distributed.rb#60
  def echo(value); end

  # Evaluate Lua script.
  #
  # source://redis//lib/redis/distributed.rb#1052
  def eval(*args); end

  # Evaluate Lua script by its SHA.
  #
  # source://redis//lib/redis/distributed.rb#1057
  def evalsha(*args); end

  # Execute all commands issued after MULTI.
  #
  # @raise [CannotDistribute]
  #
  # source://redis//lib/redis/distributed.rb#996
  def exec; end

  # Determine if a key exists.
  #
  # source://redis//lib/redis/distributed.rb#197
  def exists(*args); end

  # Determine if any of the keys exists.
  #
  # @return [Boolean]
  #
  # source://redis//lib/redis/distributed.rb#206
  def exists?(*args); end

  # Set a key's time to live in seconds.
  #
  # source://redis//lib/redis/distributed.rb#124
  def expire(key, seconds, **kwargs); end

  # Set the expiration for a key as a UNIX timestamp.
  #
  # source://redis//lib/redis/distributed.rb#129
  def expireat(key, unix_time, **kwargs); end

  # Get the expiration for a key as a UNIX timestamp.
  #
  # source://redis//lib/redis/distributed.rb#134
  def expiretime(key); end

  # Remove all keys from all databases.
  #
  # source://redis//lib/redis/distributed.rb#84
  def flushall; end

  # Remove all keys from the current database.
  #
  # source://redis//lib/redis/distributed.rb#89
  def flushdb; end

  # Get the value of a key.
  #
  # source://redis//lib/redis/distributed.rb#329
  def get(key); end

  # Returns the bit value at offset in the string value stored at key.
  #
  # source://redis//lib/redis/distributed.rb#373
  def getbit(key, offset); end

  # Get the value of a key and delete it.
  #
  # source://redis//lib/redis/distributed.rb#334
  def getdel(key); end

  # Get the value of a key and sets its time to live based on options.
  #
  # source://redis//lib/redis/distributed.rb#339
  def getex(key, **options); end

  # Get a substring of the string stored at a key.
  #
  # source://redis//lib/redis/distributed.rb#363
  def getrange(key, start, stop); end

  # Set the string value of a key and return its old value.
  #
  # source://redis//lib/redis/distributed.rb#401
  def getset(key, value); end

  # Delete one or more hash fields.
  #
  # source://redis//lib/redis/distributed.rb#886
  def hdel(key, *fields); end

  # Determine if a hash field exists.
  #
  # source://redis//lib/redis/distributed.rb#892
  def hexists(key, field); end

  # Get the value of a hash field.
  #
  # source://redis//lib/redis/distributed.rb#866
  def hget(key, field); end

  # Get all the fields and values in a hash.
  #
  # source://redis//lib/redis/distributed.rb#917
  def hgetall(key); end

  # Increment the integer value of a hash field by the given integer number.
  #
  # source://redis//lib/redis/distributed.rb#897
  def hincrby(key, field, increment); end

  # Increment the numeric value of a hash field by the given float number.
  #
  # source://redis//lib/redis/distributed.rb#902
  def hincrbyfloat(key, field, increment); end

  # Get all the fields in a hash.
  #
  # source://redis//lib/redis/distributed.rb#907
  def hkeys(key); end

  # Get the number of fields in a hash.
  #
  # source://redis//lib/redis/distributed.rb#842
  def hlen(key); end

  # Get the values of all the given hash fields.
  #
  # source://redis//lib/redis/distributed.rb#871
  def hmget(key, *fields); end

  # Set multiple hash fields to multiple values.
  #
  # source://redis//lib/redis/distributed.rb#857
  def hmset(key, *attrs); end

  # source://redis//lib/redis/distributed.rb#881
  def hrandfield(key, count = T.unsafe(nil), **options); end

  # Set multiple hash fields to multiple values.
  #
  # source://redis//lib/redis/distributed.rb#847
  def hset(key, *attrs); end

  # Set the value of a hash field, only if the field does not exist.
  #
  # source://redis//lib/redis/distributed.rb#852
  def hsetnx(key, field, value); end

  # Get all the values in a hash.
  #
  # source://redis//lib/redis/distributed.rb#912
  def hvals(key); end

  # Increment the integer value of a key by one.
  #
  # source://redis//lib/redis/distributed.rb#276
  def incr(key); end

  # Increment the integer value of a key by the given integer number.
  #
  # source://redis//lib/redis/distributed.rb#281
  def incrby(key, increment); end

  # Increment the numeric value of a key by the given float number.
  #
  # source://redis//lib/redis/distributed.rb#286
  def incrbyfloat(key, increment); end

  # Get information and statistics about the server.
  #
  # source://redis//lib/redis/distributed.rb#94
  def info(cmd = T.unsafe(nil)); end

  # source://redis//lib/redis/distributed.rb#1061
  def inspect; end

  # Find all keys matching the given pattern.
  #
  # source://redis//lib/redis/distributed.rb#216
  def keys(glob = T.unsafe(nil)); end

  # Get the UNIX time stamp of the last successful save to disk.
  #
  # source://redis//lib/redis/distributed.rb#99
  def lastsave; end

  # Get an element from a list by its index.
  #
  # source://redis//lib/redis/distributed.rb#526
  def lindex(key, index); end

  # Insert an element before or after another element in a list.
  #
  # source://redis//lib/redis/distributed.rb#531
  def linsert(key, where, pivot, value); end

  # Get the length of a list.
  #
  # source://redis//lib/redis/distributed.rb#419
  def llen(key); end

  # Remove the first/last element in a list, append/prepend it to another list and return it.
  #
  # source://redis//lib/redis/distributed.rb#424
  def lmove(source, destination, where_source, where_destination); end

  # Iterate over keys, removing elements from the first non list found.
  #
  # source://redis//lib/redis/distributed.rb#563
  def lmpop(*keys, modifier: T.unsafe(nil), count: T.unsafe(nil)); end

  # Remove and get the first elements in a list.
  #
  # source://redis//lib/redis/distributed.rb#459
  def lpop(key, count = T.unsafe(nil)); end

  # Prepend one or more values to a list.
  #
  # source://redis//lib/redis/distributed.rb#439
  def lpush(key, value); end

  # Prepend a value to a list, only if the list exists.
  #
  # source://redis//lib/redis/distributed.rb#444
  def lpushx(key, value); end

  # Get a range of elements from a list.
  #
  # source://redis//lib/redis/distributed.rb#536
  def lrange(key, start, stop); end

  # Remove elements from a list.
  #
  # source://redis//lib/redis/distributed.rb#541
  def lrem(key, count, value); end

  # Set the value of an element in a list by its index.
  #
  # source://redis//lib/redis/distributed.rb#546
  def lset(key, index, value); end

  # Trim a list to the specified range.
  #
  # source://redis//lib/redis/distributed.rb#551
  def ltrim(key, start, stop); end

  # source://redis//lib/redis/distributed.rb#876
  def mapped_hmget(key, *fields); end

  # source://redis//lib/redis/distributed.rb#861
  def mapped_hmset(key, hash); end

  # Get the values of all the given keys as a Hash.
  #
  # source://redis//lib/redis/distributed.rb#350
  def mapped_mget(*keys); end

  # @raise [CannotDistribute]
  #
  # source://redis//lib/redis/distributed.rb#315
  def mapped_mset(_hash); end

  # @raise [CannotDistribute]
  #
  # source://redis//lib/redis/distributed.rb#324
  def mapped_msetnx(_hash); end

  # Get the values of all the given keys as an Array.
  #
  # source://redis//lib/redis/distributed.rb#344
  def mget(*keys); end

  # Transfer a key from the connected instance to another instance.
  #
  # @raise [CannotDistribute]
  #
  # source://redis//lib/redis/distributed.rb#174
  def migrate(_key, _options); end

  # Listen for all requests received by the server in real time.
  #
  # @raise [NotImplementedError]
  #
  # source://redis//lib/redis/distributed.rb#104
  def monitor; end

  # Move a key to another database.
  #
  # source://redis//lib/redis/distributed.rb#221
  def move(key, db); end

  # Set multiple keys to multiple values.
  #
  # @raise [CannotDistribute]
  #
  # source://redis//lib/redis/distributed.rb#311
  def mset(*_arg0); end

  # Set multiple keys to multiple values, only if none of the keys exist.
  #
  # @raise [CannotDistribute]
  #
  # source://redis//lib/redis/distributed.rb#320
  def msetnx(*_arg0); end

  # Mark the start of a transaction block.
  #
  # @raise [CannotDistribute]
  #
  # source://redis//lib/redis/distributed.rb#989
  def multi(&block); end

  # @raise [CannotDistribute]
  #
  # source://redis//lib/redis/distributed.rb#30
  def node_for(key); end

  # source://redis//lib/redis/distributed.rb#37
  def nodes; end

  # Remove the expiration from a key.
  #
  # source://redis//lib/redis/distributed.rb#119
  def persist(key); end

  # Set a key's time to live in milliseconds.
  #
  # source://redis//lib/redis/distributed.rb#144
  def pexpire(key, milliseconds, **kwarg); end

  # Set the expiration for a key as number of milliseconds from UNIX Epoch.
  #
  # source://redis//lib/redis/distributed.rb#149
  def pexpireat(key, ms_unix_time, **kwarg); end

  # Get the expiration for a key as number of milliseconds from UNIX Epoch.
  #
  # source://redis//lib/redis/distributed.rb#154
  def pexpiretime(key); end

  # Add one or more members to a HyperLogLog structure.
  #
  # source://redis//lib/redis/distributed.rb#1019
  def pfadd(key, member); end

  # Get the approximate cardinality of members added to HyperLogLog structure.
  #
  # source://redis//lib/redis/distributed.rb#1024
  def pfcount(*keys); end

  # Merge multiple HyperLogLog values into an unique value that will approximate the cardinality of the union of
  # the observed Sets of the source HyperLogLog structures.
  #
  # source://redis//lib/redis/distributed.rb#1032
  def pfmerge(dest_key, *source_key); end

  # Ping the server.
  #
  # source://redis//lib/redis/distributed.rb#55
  def ping; end

  # @raise [CannotDistribute]
  #
  # source://redis//lib/redis/distributed.rb#984
  def pipelined; end

  # Set the time to live in milliseconds of a key.
  #
  # source://redis//lib/redis/distributed.rb#301
  def psetex(key, ttl, value); end

  # Listen for messages published to channels matching the given patterns.
  #
  # @raise [NotImplementedError]
  #
  # source://redis//lib/redis/distributed.rb#951
  def psubscribe(*channels, &block); end

  # Get the time to live (in milliseconds) for a key.
  #
  # source://redis//lib/redis/distributed.rb#159
  def pttl(key); end

  # Post a message to a channel.
  #
  # source://redis//lib/redis/distributed.rb#922
  def publish(channel, message); end

  # Stop listening for messages posted to channels matching the given
  # patterns.
  #
  # @raise [NotImplementedError]
  #
  # source://redis//lib/redis/distributed.rb#957
  def punsubscribe(*channels); end

  # Close the connection.
  #
  # source://redis//lib/redis/distributed.rb#65
  def quit; end

  # Return a random key from the keyspace.
  #
  # @raise [CannotDistribute]
  #
  # source://redis//lib/redis/distributed.rb#233
  def randomkey; end

  # Rename a key.
  #
  # source://redis//lib/redis/distributed.rb#238
  def rename(old_name, new_name); end

  # Rename a key, only if the new key does not exist.
  #
  # source://redis//lib/redis/distributed.rb#245
  def renamenx(old_name, new_name); end

  # Create a key using the serialized value, previously obtained using DUMP.
  #
  # source://redis//lib/redis/distributed.rb#169
  def restore(key, ttl, serialized_value, **options); end

  # Returns the value of attribute ring.
  #
  # source://redis//lib/redis/distributed.rb#18
  def ring; end

  # Remove and get the last elements in a list.
  #
  # source://redis//lib/redis/distributed.rb#464
  def rpop(key, count = T.unsafe(nil)); end

  # Remove the last element in a list, append it to another list and return
  # it.
  #
  # source://redis//lib/redis/distributed.rb#470
  def rpoplpush(source, destination); end

  # Append one or more values to a list.
  #
  # source://redis//lib/redis/distributed.rb#449
  def rpush(key, value); end

  # Append a value to a list, only if the list exists.
  #
  # source://redis//lib/redis/distributed.rb#454
  def rpushx(key, value); end

  # Add one or more members to a set.
  #
  # source://redis//lib/redis/distributed.rb#575
  def sadd(key, *members); end

  # Add one or more members to a set.
  #
  # @return [Boolean]
  #
  # source://redis//lib/redis/distributed.rb#580
  def sadd?(key, *members); end

  # Synchronously save the dataset to disk.
  #
  # source://redis//lib/redis/distributed.rb#109
  def save; end

  # Get the number of members in a set.
  #
  # source://redis//lib/redis/distributed.rb#570
  def scard(key); end

  # Control remote script registry.
  #
  # source://redis//lib/redis/distributed.rb#1014
  def script(subcommand, *args); end

  # Subtract multiple sets.
  #
  # source://redis//lib/redis/distributed.rb#637
  def sdiff(*keys); end

  # Subtract multiple sets and store the resulting set in a key.
  #
  # source://redis//lib/redis/distributed.rb#645
  def sdiffstore(destination, *keys); end

  # Change the selected database for the current connection.
  #
  # source://redis//lib/redis/distributed.rb#50
  def select(db); end

  # Set the string value of a key.
  #
  # source://redis//lib/redis/distributed.rb#291
  def set(key, value, **options); end

  # Sets or clears the bit at offset in the string value stored at key.
  #
  # source://redis//lib/redis/distributed.rb#368
  def setbit(key, offset, value); end

  # Set the time to live in seconds of a key.
  #
  # source://redis//lib/redis/distributed.rb#296
  def setex(key, ttl, value); end

  # Set the value of a key, only if the key does not exist.
  #
  # source://redis//lib/redis/distributed.rb#306
  def setnx(key, value); end

  # Overwrite part of a string at key starting at the specified offset.
  #
  # source://redis//lib/redis/distributed.rb#358
  def setrange(key, offset, value); end

  # Intersect multiple sets.
  #
  # source://redis//lib/redis/distributed.rb#653
  def sinter(*keys); end

  # Intersect multiple sets and store the resulting set in a key.
  #
  # source://redis//lib/redis/distributed.rb#661
  def sinterstore(destination, *keys); end

  # Determine if a given value is a member of a set.
  #
  # source://redis//lib/redis/distributed.rb#612
  def sismember(key, member); end

  # Get all the members in a set.
  #
  # source://redis//lib/redis/distributed.rb#622
  def smembers(key); end

  # Determine if multiple values are members of a set.
  #
  # source://redis//lib/redis/distributed.rb#617
  def smismember(key, *members); end

  # Move a member from one set to another.
  #
  # source://redis//lib/redis/distributed.rb#605
  def smove(source, destination, member); end

  # Sort the elements in a list, set or sorted set.
  #
  # source://redis//lib/redis/distributed.rb#252
  def sort(key, **options); end

  # Remove and return a random member from a set.
  #
  # source://redis//lib/redis/distributed.rb#595
  def spop(key, count = T.unsafe(nil)); end

  # Get a random member from a set.
  #
  # source://redis//lib/redis/distributed.rb#600
  def srandmember(key, count = T.unsafe(nil)); end

  # Remove one or more members from a set.
  #
  # source://redis//lib/redis/distributed.rb#585
  def srem(key, *members); end

  # Remove one or more members from a set.
  #
  # @return [Boolean]
  #
  # source://redis//lib/redis/distributed.rb#590
  def srem?(key, *members); end

  # Scan a set
  #
  # source://redis//lib/redis/distributed.rb#627
  def sscan(key, cursor, **options); end

  # Scan a set and return an enumerator
  #
  # source://redis//lib/redis/distributed.rb#632
  def sscan_each(key, **options, &block); end

  # Get the length of the value stored in a key.
  #
  # source://redis//lib/redis/distributed.rb#406
  def strlen(key); end

  # Listen for messages published to the given channels.
  #
  # source://redis//lib/redis/distributed.rb#931
  def subscribe(channel, *channels, &block); end

  # @return [Boolean]
  #
  # source://redis//lib/redis/distributed.rb#926
  def subscribed?; end

  # Add multiple sets.
  #
  # source://redis//lib/redis/distributed.rb#669
  def sunion(*keys); end

  # Add multiple sets and store the resulting set in a key.
  #
  # source://redis//lib/redis/distributed.rb#677
  def sunionstore(destination, *keys); end

  # Get server time: an UNIX timestamp and the elapsed microseconds in the current second.
  #
  # source://redis//lib/redis/distributed.rb#114
  def time; end

  # Get the time to live (in seconds) for a key.
  #
  # source://redis//lib/redis/distributed.rb#139
  def ttl(key); end

  # Determine the type stored at key.
  #
  # source://redis//lib/redis/distributed.rb#261
  def type(key); end

  # Unlink keys.
  #
  # source://redis//lib/redis/distributed.rb#188
  def unlink(*args); end

  # Stop listening for messages posted to the given channels.
  #
  # @raise [SubscriptionError]
  #
  # source://redis//lib/redis/distributed.rb#944
  def unsubscribe(*channels); end

  # Forget about all watched keys.
  #
  # @raise [CannotDistribute]
  #
  # source://redis//lib/redis/distributed.rb#976
  def unwatch; end

  # Watch the given keys to determine execution of the MULTI/EXEC block.
  #
  # source://redis//lib/redis/distributed.rb#962
  def watch(*keys, &block); end

  # Add one or more members to a sorted set, or update the score for members
  # that already exist.
  #
  # source://redis//lib/redis/distributed.rb#691
  def zadd(key, *args, **_arg2); end

  # Get the number of members in a sorted set.
  #
  # source://redis//lib/redis/distributed.rb#685
  def zcard(key); end

  # Get the number of members in a particular score range.
  #
  # source://redis//lib/redis/distributed.rb#787
  def zcount(key, min, max); end

  # Return the difference between the first and all successive input sorted sets.
  #
  # source://redis//lib/redis/distributed.rb#825
  def zdiff(*keys, **options); end

  # Compute the difference between the first and all successive input sorted sets
  # and store the resulting sorted set in a new key.
  #
  # source://redis//lib/redis/distributed.rb#834
  def zdiffstore(destination, *keys, **options); end

  # Increment the score of a member in a sorted set.
  #
  # source://redis//lib/redis/distributed.rb#697
  def zincrby(key, increment, member); end

  # Get the intersection of multiple sorted sets
  #
  # source://redis//lib/redis/distributed.rb#792
  def zinter(*keys, **options); end

  # Intersect multiple sorted sets and store the resulting sorted set in a new
  # key.
  #
  # source://redis//lib/redis/distributed.rb#801
  def zinterstore(destination, *keys, **options); end

  # Iterate over keys, removing members from the first non empty sorted set found.
  #
  # source://redis//lib/redis/distributed.rb#729
  def zmpop(*keys, modifier: T.unsafe(nil), count: T.unsafe(nil)); end

  # Get the scores associated with the given members in a sorted set.
  #
  # source://redis//lib/redis/distributed.rb#717
  def zmscore(key, *members); end

  # Get one or more random members from a sorted set.
  #
  # source://redis//lib/redis/distributed.rb#712
  def zrandmember(key, count = T.unsafe(nil), **options); end

  # Return a range of members in a sorted set, by index, score or lexicographical ordering.
  #
  # source://redis//lib/redis/distributed.rb#736
  def zrange(key, start, stop, **options); end

  # Return a range of members in a sorted set, by score.
  #
  # source://redis//lib/redis/distributed.rb#771
  def zrangebyscore(key, min, max, **options); end

  # Select a range of members in a sorted set, by index, score or lexicographical ordering
  # and store the resulting sorted set in a new key.
  #
  # source://redis//lib/redis/distributed.rb#742
  def zrangestore(dest_key, src_key, start, stop, **options); end

  # Determine the index of a member in a sorted set.
  #
  # source://redis//lib/redis/distributed.rb#755
  def zrank(key, member); end

  # Remove one or more members from a sorted set.
  #
  # source://redis//lib/redis/distributed.rb#702
  def zrem(key, member); end

  # Remove all members in a sorted set within the given indexes.
  #
  # source://redis//lib/redis/distributed.rb#766
  def zremrangebyrank(key, start, stop); end

  # Remove all members in a sorted set within the given scores.
  #
  # source://redis//lib/redis/distributed.rb#782
  def zremrangebyscore(key, min, max); end

  # Return a range of members in a sorted set, by index, with scores ordered
  # from high to low.
  #
  # source://redis//lib/redis/distributed.rb#750
  def zrevrange(key, start, stop, **options); end

  # Return a range of members in a sorted set, by score, with scores ordered
  # from high to low.
  #
  # source://redis//lib/redis/distributed.rb#777
  def zrevrangebyscore(key, max, min, **options); end

  # Determine the index of a member in a sorted set, with scores ordered from
  # high to low.
  #
  # source://redis//lib/redis/distributed.rb#761
  def zrevrank(key, member); end

  # Get the score associated with the given member in a sorted set.
  #
  # source://redis//lib/redis/distributed.rb#707
  def zscore(key, member); end

  # Return the union of multiple sorted sets.
  #
  # source://redis//lib/redis/distributed.rb#809
  def zunion(*keys, **options); end

  # Add multiple sorted sets and store the resulting sorted set in a new key.
  #
  # source://redis//lib/redis/distributed.rb#817
  def zunionstore(destination, *keys, **options); end

  protected

  # @yield [node_for(keys.first)]
  #
  # source://redis//lib/redis/distributed.rb#1086
  def ensure_same_node(command, keys); end

  # source://redis//lib/redis/distributed.rb#1081
  def key_tag(key); end

  # source://redis//lib/redis/distributed.rb#1077
  def node_index_for(key); end

  # source://redis//lib/redis/distributed.rb#1071
  def on_each_node(command, *args); end
end

# source://redis//lib/redis/distributed.rb#7
class Redis::Distributed::CannotDistribute < ::RuntimeError
  # @return [CannotDistribute] a new instance of CannotDistribute
  #
  # source://redis//lib/redis/distributed.rb#8
  def initialize(command); end

  # source://redis//lib/redis/distributed.rb#12
  def message; end
end

# source://redis//lib/redis/pipeline.rb#80
class Redis::Future < ::BasicObject
  # @return [Future] a new instance of Future
  #
  # source://redis//lib/redis/pipeline.rb#83
  def initialize(command, coerce, exception); end

  # source://redis//lib/redis/pipeline.rb#94
  def _set(object); end

  # source://redis//lib/redis/pipeline.rb#108
  def class; end

  # source://redis//lib/redis/pipeline.rb#90
  def inspect; end

  # @return [Boolean]
  #
  # source://redis//lib/redis/pipeline.rb#104
  def is_a?(other); end

  # source://redis//lib/redis/pipeline.rb#99
  def value; end
end

# source://redis//lib/redis/pipeline.rb#81
Redis::Future::FutureNotReady = T.let(T.unsafe(nil), Redis::FutureNotReady)

# source://redis//lib/redis/pipeline.rb#74
class Redis::FutureNotReady < ::RuntimeError
  # @return [FutureNotReady] a new instance of FutureNotReady
  #
  # source://redis//lib/redis/pipeline.rb#75
  def initialize; end
end

# source://redis//lib/redis/hash_ring.rb#7
class Redis::HashRing
  # nodes is a list of objects that have a proper to_s representation.
  # replicas indicates how many virtual points should be used pr. node,
  # replicas are required to improve the distribution.
  #
  # @return [HashRing] a new instance of HashRing
  #
  # source://redis//lib/redis/hash_ring.rb#15
  def initialize(nodes = T.unsafe(nil), replicas = T.unsafe(nil)); end

  # Adds a `node` to the hash ring (including a number of replicas).
  #
  # source://redis//lib/redis/hash_ring.rb#26
  def add_node(node); end

  # get the node in the hash ring for this key
  #
  # source://redis//lib/redis/hash_ring.rb#46
  def get_node(key); end

  # source://redis//lib/redis/hash_ring.rb#52
  def iter_nodes(key); end

  # Returns the value of attribute nodes.
  #
  # source://redis//lib/redis/hash_ring.rb#10
  def nodes; end

  # source://redis//lib/redis/hash_ring.rb#36
  def remove_node(node); end

  # Returns the value of attribute replicas.
  #
  # source://redis//lib/redis/hash_ring.rb#10
  def replicas; end

  # Returns the value of attribute ring.
  #
  # source://redis//lib/redis/hash_ring.rb#10
  def ring; end

  # Returns the value of attribute sorted_keys.
  #
  # source://redis//lib/redis/hash_ring.rb#10
  def sorted_keys; end

  private

  # Find the closest index in HashRing with value <= the given value
  #
  # source://redis//lib/redis/hash_ring.rb#73
  def binary_search(ary, value); end

  # source://redis//lib/redis/hash_ring.rb#64
  def hash_for(key); end

  # source://redis//lib/redis/hash_ring.rb#68
  def server_hash_for(key); end
end

# this is the default in libmemcached
#
# source://redis//lib/redis/hash_ring.rb#8
Redis::HashRing::POINTS_PER_SERVER = T.let(T.unsafe(nil), Integer)

# Raised when the connection was inherited by a child process.
#
# source://redis//lib/redis/errors.rb#49
class Redis::InheritedError < ::Redis::BaseConnectionError; end

# Raised when client options are invalid.
#
# source://redis//lib/redis/errors.rb#57
class Redis::InvalidClientOptionError < ::Redis::BaseError; end

# source://redis//lib/redis/pipeline.rb#59
class Redis::MultiConnection < ::Redis::PipelinedConnection
  # @raise [Redis::Error]
  #
  # source://redis//lib/redis/pipeline.rb#60
  def multi; end

  private

  # Blocking commands inside transaction behave like non-blocking.
  # It shouldn't be done though.
  # https://redis.io/commands/blpop/#blpop-inside-a-multi--exec-transaction
  #
  # source://redis//lib/redis/pipeline.rb#69
  def send_blocking_command(command, _timeout, &block); end
end

# source://redis//lib/redis/pipeline.rb#113
class Redis::MultiFuture < ::Redis::Future
  # @return [MultiFuture] a new instance of MultiFuture
  #
  # source://redis//lib/redis/pipeline.rb#114
  def initialize(futures); end

  # source://redis//lib/redis/pipeline.rb#120
  def _set(replies); end
end

# source://redis//lib/redis/errors.rb#29
class Redis::OutOfMemoryError < ::Redis::CommandError; end

# source://redis//lib/redis/errors.rb#23
class Redis::PermissionError < ::Redis::CommandError; end

# source://redis//lib/redis/pipeline.rb#6
class Redis::PipelinedConnection
  include ::Redis::Commands::Bitmaps
  include ::Redis::Commands::Cluster
  include ::Redis::Commands::Connection
  include ::Redis::Commands::Geo
  include ::Redis::Commands::Hashes
  include ::Redis::Commands::HyperLogLog
  include ::Redis::Commands::Keys
  include ::Redis::Commands::Lists
  include ::Redis::Commands::Pubsub
  include ::Redis::Commands::Scripting
  include ::Redis::Commands::Server
  include ::Redis::Commands::Sets
  include ::Redis::Commands::SortedSets
  include ::Redis::Commands::Streams
  include ::Redis::Commands::Strings
  include ::Redis::Commands::Transactions
  include ::Redis::Commands

  # @return [PipelinedConnection] a new instance of PipelinedConnection
  #
  # source://redis//lib/redis/pipeline.rb#9
  def initialize(pipeline, futures = T.unsafe(nil), exception: T.unsafe(nil)); end

  # Returns the value of attribute db.
  #
  # source://redis//lib/redis/pipeline.rb#7
  def db; end

  # Sets the attribute db
  #
  # @param value the value to set the attribute db to.
  #
  # source://redis//lib/redis/pipeline.rb#7
  def db=(_arg0); end

  # @yield [transaction]
  #
  # source://redis//lib/redis/pipeline.rb#21
  def multi; end

  # @yield [_self]
  # @yieldparam _self [Redis::PipelinedConnection] the object that the method was called on
  #
  # source://redis//lib/redis/pipeline.rb#17
  def pipelined; end

  private

  # source://redis//lib/redis/pipeline.rb#49
  def send_blocking_command(command, timeout, &block); end

  # source://redis//lib/redis/pipeline.rb#40
  def send_command(command, &block); end

  # @yield [_self]
  # @yieldparam _self [Redis::PipelinedConnection] the object that the method was called on
  #
  # source://redis//lib/redis/pipeline.rb#36
  def synchronize; end
end

# Raised by the connection when a protocol error occurs.
#
# source://redis//lib/redis/errors.rb#9
class Redis::ProtocolError < ::Redis::BaseError
  # @return [ProtocolError] a new instance of ProtocolError
  #
  # source://redis//lib/redis/errors.rb#10
  def initialize(reply_type); end
end

# Generally raised during Redis failover scenarios
#
# source://redis//lib/redis/errors.rb#53
class Redis::ReadOnlyError < ::Redis::BaseConnectionError; end

# source://redis//lib/redis.rb#37
Redis::SERVER_URL_OPTIONS = T.let(T.unsafe(nil), Array)

# source://redis//lib/redis/subscribe.rb#4
class Redis::SubscribedClient
  # @return [SubscribedClient] a new instance of SubscribedClient
  #
  # source://redis//lib/redis/subscribe.rb#5
  def initialize(client); end

  # source://redis//lib/redis/subscribe.rb#10
  def call_v(command); end

  # source://redis//lib/redis/subscribe.rb#52
  def close; end

  # source://redis//lib/redis/subscribe.rb#24
  def psubscribe(*channels, &block); end

  # source://redis//lib/redis/subscribe.rb#28
  def psubscribe_with_timeout(timeout, *channels, &block); end

  # source://redis//lib/redis/subscribe.rb#44
  def punsubscribe(*channels); end

  # source://redis//lib/redis/subscribe.rb#32
  def ssubscribe(*channels, &block); end

  # source://redis//lib/redis/subscribe.rb#36
  def ssubscribe_with_timeout(timeout, *channels, &block); end

  # source://redis//lib/redis/subscribe.rb#16
  def subscribe(*channels, &block); end

  # source://redis//lib/redis/subscribe.rb#20
  def subscribe_with_timeout(timeout, *channels, &block); end

  # source://redis//lib/redis/subscribe.rb#48
  def sunsubscribe(*channels); end

  # source://redis//lib/redis/subscribe.rb#40
  def unsubscribe(*channels); end

  protected

  # source://redis//lib/redis/subscribe.rb#58
  def subscription(start, stop, channels, block, timeout = T.unsafe(nil)); end
end

# source://redis//lib/redis/subscribe.rb#82
class Redis::Subscription
  # @return [Subscription] a new instance of Subscription
  # @yield [_self]
  # @yieldparam _self [Redis::Subscription] the object that the method was called on
  #
  # source://redis//lib/redis/subscribe.rb#85
  def initialize; end

  # Returns the value of attribute callbacks.
  #
  # source://redis//lib/redis/subscribe.rb#83
  def callbacks; end

  # source://redis//lib/redis/subscribe.rb#98
  def message(&block); end

  # source://redis//lib/redis/subscribe.rb#110
  def pmessage(&block); end

  # source://redis//lib/redis/subscribe.rb#102
  def psubscribe(&block); end

  # source://redis//lib/redis/subscribe.rb#106
  def punsubscribe(&block); end

  # source://redis//lib/redis/subscribe.rb#122
  def smessage(&block); end

  # source://redis//lib/redis/subscribe.rb#114
  def ssubscribe(&block); end

  # source://redis//lib/redis/subscribe.rb#90
  def subscribe(&block); end

  # source://redis//lib/redis/subscribe.rb#118
  def sunsubscribe(&block); end

  # source://redis//lib/redis/subscribe.rb#94
  def unsubscribe(&block); end
end

# source://redis//lib/redis/errors.rb#60
class Redis::SubscriptionError < ::Redis::BaseError; end

# Raised when performing I/O times out.
#
# source://redis//lib/redis/errors.rb#45
class Redis::TimeoutError < ::Redis::BaseConnectionError; end

# source://redis//lib/redis/version.rb#4
Redis::VERSION = T.let(T.unsafe(nil), String)

# source://redis//lib/redis/errors.rb#26
class Redis::WrongTypeError < ::Redis::CommandError; end