Sha256: 2462f357b48ac029b24370ca6bd6d9c8740d9182f58647011b0161eabd6fd1f5

Contents?: true

Size: 802 Bytes

Versions: 1

Compression:

Stored size: 802 Bytes

Contents

module FFI
  module HiredisVip
    class ExistsBefore3
      def initialize(client)
        @client = client
      end

      def exists(*keys)
        keys = keys.flatten
        number_of_exists = 0
        command = "EXISTS %b"

        keys.each do |key|
          reply = nil
          command_args = [ :string, key, :size_t, key.size ]
          @client.synchronize do |connection|
            reply = ::FFI::HiredisVip::Core.command(connection, command, *command_args)
          end

          next if reply.nil? || reply.null?

          case reply[:type] 
          when :REDIS_REPLY_INTEGER
            number_of_exists = number_of_exists + reply[:integer]
          end
        end

        number_of_exists
      end
    end # class ExistsBefore3
  end # module HiredisVip
end # module FFI

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ffi-hiredis_vip-0.1.0.pre1 lib/ffi/hiredis_vip/exists_before_3.rb