mirror of
https://github.com/fluencelabs/redis
synced 2025-06-12 08:41:21 +00:00
CPP client added thanks to Brian Hammond
This commit is contained in:
31
client-libraries/ruby/lib/pipeline.rb
Normal file
31
client-libraries/ruby/lib/pipeline.rb
Normal file
@ -0,0 +1,31 @@
|
||||
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
|
Reference in New Issue
Block a user