Sha256: 6ccfcddee99644342152c43b4b8a7130e9d8b807d5b4dcfc33e9544f71e602af
Contents?: true
Size: 1001 Bytes
Versions: 1
Compression:
Stored size: 1001 Bytes
Contents
module FFI module HiredisVip class Exists def initialize(client) @client = client end def exists(*keys) reply = nil keys = keys.flatten number_of_exists = keys.size command = "EXISTS#{' %b' * number_of_exists}" command_args = [] keys.each do |key| command_args << :pointer << key << :size_t << key.size end synchronize do |connection| reply = @client.execute_command(connection, command, *command_args) end return nil if reply.nil? || reply.null? case reply[:type] when :REDIS_REPLY_INTEGER reply[:integer] else 0 end ensure ::FFI::HiredisVip::Core.freeReplyObject(reply.pointer) if reply end private def synchronize @client.synchronize do |connection| yield(connection) end end end # class Exists end # module HiredisVip end # module FFI
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ffi-hiredis_vip-0.1.0.pre4 | lib/ffi/hiredis_vip/exists.rb |