Class: RedisClient::Cluster::Command::Spec

Inherits:
Struct
  • Object
show all
Defined in:
lib/redis_client/cluster/command.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#first_key_positionObject

Returns the value of attribute first_key_position

Returns:

  • (Object)

    the current value of first_key_position



15
16
17
# File 'lib/redis_client/cluster/command.rb', line 15

def first_key_position
  @first_key_position
end

#key_stepObject

Returns the value of attribute key_step

Returns:

  • (Object)

    the current value of key_step



15
16
17
# File 'lib/redis_client/cluster/command.rb', line 15

def key_step
  @key_step
end

#readonly?Object

Returns the value of attribute readonly?

Returns:

  • (Object)

    the current value of readonly?



15
16
17
# File 'lib/redis_client/cluster/command.rb', line 15

def readonly?
  @readonly?
end

#write?Object

Returns the value of attribute write?

Returns:

  • (Object)

    the current value of write?



15
16
17
# File 'lib/redis_client/cluster/command.rb', line 15

def write?
  @write?
end

Instance Method Details

#extract_first_key(command) ⇒ Object



23
24
25
26
27
28
29
30
31
# File 'lib/redis_client/cluster/command.rb', line 23

def extract_first_key(command)
  i = first_key_position.to_i
  return command[i] if i > 0

  i = determine_first_key_position(command)
  return ::RedisClient::Cluster::Command::EMPTY_STRING if i == 0

  command[i]
end

#should_send_to_primary?Boolean

Returns:

  • (Boolean)


33
34
35
# File 'lib/redis_client/cluster/command.rb', line 33

def should_send_to_primary?
  write?
end

#should_send_to_replica?Boolean

Returns:

  • (Boolean)


37
38
39
# File 'lib/redis_client/cluster/command.rb', line 37

def should_send_to_replica?
  readonly?
end