lib/ffi/hiredis_vip/client.rb in ffi-hiredis_vip-0.1.0.pre2 vs lib/ffi/hiredis_vip/client.rb in ffi-hiredis_vip-0.1.0.pre3
- old
+ new
@@ -69,11 +69,11 @@
end
def decr(key)
reply = nil
command = "DECR %b"
- command_args = [ :string, key, :size_t, key.size ]
+ command_args = [ :pointer, key, :size_t, key.size ]
synchronize do |connection|
reply = execute_command(connection, command, *command_args)
end
return nil if reply.nil? || reply.null?
@@ -88,11 +88,11 @@
def decrby(key, amount)
reply = nil
_amount = "#{amount}"
command = "DECRBY %b %b"
- command_args = [ :string, key, :size_t, key.size, :string, _amount, :size_t, _amount.size ]
+ command_args = [ :pointer, key, :size_t, key.size, :string, _amount, :size_t, _amount.size ]
synchronize do |connection|
reply = execute_command(connection, command, *command_args)
end
return nil if reply.nil? || reply.null?
@@ -110,11 +110,11 @@
keys = keys.flatten
number_of_deletes = keys.size
command = "DEL#{' %b' * number_of_deletes}"
command_args = []
keys.each do |key|
- command_args << :string << key << :size_t << key.size
+ command_args << :pointer << key << :size_t << key.size
end
synchronize do |connection|
reply = execute_command(connection, command, *command_args)
end
@@ -130,11 +130,11 @@
end
def dump(key)
reply = nil
command = "DUMP %b"
- command_args = [ :string, key, :size_t, key.size ]
+ command_args = [ :pointer, key, :size_t, key.size ]
synchronize do |connection|
reply = execute_command(connection, command, *command_args)
end
return nil if reply.nil? || reply.null?
@@ -148,11 +148,11 @@
end
def echo(value)
reply = nil
command = "ECHO %b"
- command_args = [ :string, value, :size_t, value.size ]
+ command_args = [ :pointer, value, :size_t, value.size ]
synchronize do |connection|
reply = execute_command(connection, command, *command_args)
end
return nil if reply.nil? || reply.null?
@@ -181,11 +181,11 @@
def expire(key, seconds)
reply = nil
time_in_seconds = "#{seconds}"
command = "EXPIRE %b %b"
- command_args = [ :string, key, :size_t, key.size, :string, time_in_seconds, :size_t, time_in_seconds.size ]
+ command_args = [ :pointer, key, :size_t, key.size, :string, time_in_seconds, :size_t, time_in_seconds.size ]
synchronize do |connection|
reply = execute_command(connection, command, *command_args)
end
# TODO: should we return a 0 here?
@@ -205,11 +205,11 @@
def expireat(key, unix_time)
reply = nil
epoch = "#{unix_time}"
command = "EXPIREAT %b %b"
- command_args = [ :string, key, :size_t, key.size, :string, epoch, :size_t, epoch.size ]
+ command_args = [ :pointer, key, :size_t, key.size, :string, epoch, :size_t, epoch.size ]
synchronize do |connection|
reply = execute_command(connection, command, *command_args)
end
return 0 if reply.nil? || reply.null?
@@ -267,11 +267,11 @@
end
def get(key)
reply = nil
command = "GET %b"
- command_args = [ :string, key, :size_t, key.size ]
+ command_args = [ :pointer, key, :size_t, key.size ]
synchronize do |connection|
reply = execute_command(connection, command, *command_args)
end
@@ -289,11 +289,11 @@
alias_method :[], :get
def incr(key)
reply = nil
command = "INCR %b"
- command_args = [ :string, key, :size_t, key.size ]
+ command_args = [ :pointer, key, :size_t, key.size ]
synchronize do |connection|
reply = execute_command(connection, command, *command_args)
end
return nil if reply.nil? || reply.null?
@@ -308,11 +308,11 @@
def incrby(key, amount)
reply = nil
_amount = "#{amount}"
command = "INCRBY %b %b"
- command_args = [ :string, key, :size_t, key.size, :string, _amount, :size_t, _amount.size ]
+ command_args = [ :pointer, key, :size_t, key.size, :string, _amount, :size_t, _amount.size ]
synchronize do |connection|
reply = execute_command(connection, command, *command_args)
end
return nil if reply.nil? || reply.null?
@@ -498,10 +498,10 @@
end
def ttl(key)
reply = nil
command = "TTL %b"
- command_args = [ :string, key, :size_t, key.size ]
+ command_args = [ :pointer, key, :size_t, key.size ]
synchronize do |connection|
reply = execute_command(connection, command, *command_args)
end
return nil if reply.nil? || reply.null?