123456789_123456789_123456789_123456789_123456789_

Module: Redis::Commands::Cluster

Relationships & Source Files
Extension / Inclusion / Inheritance Descendants
Included In:
Defined in: lib/redis/commands/cluster.rb

Instance Method Summary

Instance Method Details

#askingString

Sends ASKING command to random node and returns its reply.

Returns:

  • (String)

    'OK'

See Also:

[ GitHub ]

  
# File 'lib/redis/commands/cluster.rb', line 30

def asking
  send_command(%i[asking])
end

#cluster(subcommand, *args) ⇒ Object

Sends CLUSTER * command to random node and returns its reply.

Examples:

Per-slot usage stats for a range (Redis 8.2)

redis.cluster('slot-stats', 'SLOTSRANGE', 0, 100)
  # => [[0, {"key-count" => 1}], [1, {"key-count" => 0}], ...]

Top slots by key count (Redis 8.2)

redis.cluster('slot-stats', 'ORDERBY', 'key-count', 'LIMIT', 3, 'DESC')

Parameters:

  • subcommand (String, Symbol)

    the subcommand of cluster command e.g. :slots, :nodes, :slaves, :info, :'slot-stats'

Returns:

  • (Object)

    depends on the subcommand

See Also:

[ GitHub ]

  
# File 'lib/redis/commands/cluster.rb', line 20

def cluster(subcommand, *args)
  block = subcommand.to_s.downcase == 'slot-stats' ? HashifyClusterSlotStats : Noop
  send_command([:cluster, subcommand] + args, &block)
end