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

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

Overview

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



21
22
23
# File 'lib/redis_client/cluster/command.rb', line 21

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



21
22
23
# File 'lib/redis_client/cluster/command.rb', line 21

def key_step
  @key_step
end

#readonly?Object

Returns the value of attribute readonly?

Returns:

  • (Object)

    the current value of readonly?



21
22
23
# File 'lib/redis_client/cluster/command.rb', line 21

def readonly?
  @readonly?
end

#request_policyObject

Returns the value of attribute request_policy

Returns:

  • (Object)

    the current value of request_policy



21
22
23
# File 'lib/redis_client/cluster/command.rb', line 21

def request_policy
  @request_policy
end

#response_policyObject

Returns the value of attribute response_policy

Returns:

  • (Object)

    the current value of response_policy



21
22
23
# File 'lib/redis_client/cluster/command.rb', line 21

def response_policy
  @response_policy
end

#subcommandsObject

Returns the value of attribute subcommands

Returns:

  • (Object)

    the current value of subcommands



21
22
23
# File 'lib/redis_client/cluster/command.rb', line 21

def subcommands
  @subcommands
end

#write?Object

Returns the value of attribute write?

Returns:

  • (Object)

    the current value of write?



21
22
23
# File 'lib/redis_client/cluster/command.rb', line 21

def write?
  @write?
end

Instance Method Details

#extract_first_key(command) ⇒ Object



32
33
34
35
36
37
38
39
40
# File 'lib/redis_client/cluster/command.rb', line 32

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)


42
43
44
# File 'lib/redis_client/cluster/command.rb', line 42

def should_send_to_primary?
  write?
end

#should_send_to_replica?Boolean

Returns:

  • (Boolean)


46
47
48
# File 'lib/redis_client/cluster/command.rb', line 46

def should_send_to_replica?
  readonly?
end