Module: Rediska::CommandExecutor

Included in:
Connection
Defined in:
lib/rediska/command_executor.rb

Instance Method Summary collapse

Instance Method Details

#write(command) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/rediska/command_executor.rb', line 3

def write(command)
  meffod = command.shift.to_s.downcase.to_sym

  if in_multi && !(TRANSACTION_COMMANDS.include? meffod) # queue commands
    queued_commands << [meffod, *command]
    reply = 'QUEUED'
  elsif respond_to?(meffod)
    reply = send(meffod, *command)
  else
    raise Redis::CommandError, "ERR unknown command '#{meffod}'"
  end

  if reply == true
    reply = 1
  elsif reply == false
    reply = 0
  end

  replies << reply
  nil
end