1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
|
# frozen_string_literal: true
class Redis
module Commands
module Cluster
# Sends `CLUSTER *` command to random node and returns its reply.
#
# @see https://redis.io/commands#cluster Reference of cluster command
#
# @param subcommand [String, Symbol] the subcommand of cluster command
# e.g. `:slots`, `:nodes`, `:slaves`, `:info`
#
# @return [Object] depends on the subcommand
def cluster(subcommand, *args)
send_command([:cluster, subcommand] + args)
end
# Sends `ASKING` command to random node and returns its reply.
#
# @see https://redis.io/topics/cluster-spec#ask-redirection ASK redirection
#
# @return [String] `'OK'`
def asking
send_command(%i[asking])
end
end
end
end
|