]> git.saurik.com Git - redis.git/blobdiff - client-libraries/ruby/lib/pipeline.rb
Redis-rb sync
[redis.git] / client-libraries / ruby / lib / pipeline.rb
index acab5acc5c7e2c434424cfed314e21e055d21a42..f92b96db527f97223c7b54ff20d63d3da4f504dc 100644 (file)
@@ -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