Sha256: 7e3a1c1e6f26187e92e21cadf111af0c934bb1d4466c4dcd68c5a78765a1e3c3

Contents?: true

Size: 794 Bytes

Versions: 1

Compression:

Stored size: 794 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 = @client.execute_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.pre2 lib/ffi/hiredis_vip/exists_before_3.rb