X-Git-Url: https://git.saurik.com/redis.git/blobdiff_plain/69664139b5a57d08b2a17f624d5e9940761c9a3f..38210f7fe571c6b892f539d11d0c69ee1a93d00b:/client-libraries/ruby/lib/pipeline.rb diff --git a/client-libraries/ruby/lib/pipeline.rb b/client-libraries/ruby/lib/pipeline.rb index acab5acc..f92b96db 100644 --- a/client-libraries/ruby/lib/pipeline.rb +++ b/client-libraries/ruby/lib/pipeline.rb @@ -8,13 +8,19 @@ class Redis @redis = redis @commands = [] end - - def call_command(command) - @commands << command + + def execute_command(data) + @commands << data + write_and_read if @commands.size >= BUFFER_SIZE end - - def execute - @redis.call_command(@commands) + + def finish + write_and_read + end + + def write_and_read + @redis.execute_command(@commands.join, true) + @redis.read_socket @commands.clear end