Sha256: f164a148a2c510b11b6879ead9243a9daf103b68738215e0877ec0a9048df539

Contents?: true

Size: 485 Bytes

Versions: 2

Compression:

Stored size: 485 Bytes

Contents

require "redis"

class Redis
  class Pipeline < Redis
    BUFFER_SIZE = 50_000
    
    def initialize(redis)
      @redis = redis
      @commands = []
    end
    
    def get_response
    end
    
    def write(data)
      @commands << data
      write_and_read if @commands.size >= BUFFER_SIZE
    end
    
    def finish
      write_and_read
    end
    
    def write_and_read
      @redis.write @commands.join
      @redis.read_socket
      @commands.clear
    end
    
  end
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
ezmobius-redis-0.0.3.4 lib/pipeline.rb
timcharper-redis-0.0.3.4 lib/pipeline.rb