class Redis

def cluster(subcommand, *args)

Returns:
  • (Object) - depends on the subcommand

Parameters:
  • subcommand (String, Symbol) -- the subcommand of cluster command

Other tags:
    See: https://redis.io/commands#cluster - Reference of cluster command
def cluster(subcommand, *args)
  subcommand = subcommand.to_s.downcase
  block = case subcommand
          when 'slots'  then HashifyClusterSlots
          when 'nodes'  then HashifyClusterNodes
          when 'slaves' then HashifyClusterSlaves
          when 'info'   then HashifyInfo
          else Noop
          end
  # @see https://github.com/antirez/redis/blob/unstable/src/redis-trib.rb#L127 raw reply expected
  block = Noop unless @cluster_mode
  synchronize do |client|
    client.call([:cluster, subcommand] + args, &block)
  end
end