<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>lib/pipeline.rb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -4,12 +4,41 @@ require 'redis'
 
 times = 20000
 
-@r = Redis.new
+@r = Redis.new#(:debug =&gt; true)
 @r['foo'] = &quot;The first line we sent to the server is some text&quot;
+
 Benchmark.bmbm do |x|
-  x.report(&quot;set&quot;) { 20000.times {|i| @r[&quot;foo#{i}&quot;] = &quot;The first line we sent to the server is some text&quot;; @r[&quot;foo#{i}&quot;]} }
+  x.report(&quot;set&quot;) do
+    20000.times do |i|
+      @r[&quot;set#{i}&quot;] = &quot;The first line we sent to the server is some text&quot;; @r[&quot;foo#{i}&quot;]
+    end
+  end
+  
+  x.report(&quot;set (pipelined)&quot;) do
+    @r.pipelined do |pipeline|
+      20000.times do |i|
+        pipeline[&quot;set_pipelined#{i}&quot;] = &quot;The first line we sent to the server is some text&quot;; @r[&quot;foo#{i}&quot;]
+      end
+    end
+  end
+  
+  x.report(&quot;push+trim&quot;) do
+    20000.times do |i|
+      @r.push_head &quot;push_trim#{i}&quot;, i
+      @r.list_trim &quot;push_trim#{i}&quot;, 0, 30
+    end
+  end
+  
+  x.report(&quot;push+trim (pipelined)&quot;) do
+    @r.pipelined do |pipeline|
+      20000.times do |i|
+        pipeline.push_head &quot;push_trim_pipelined#{i}&quot;, i
+        pipeline.list_trim &quot;push_trim_pipelined#{i}&quot;, 0, 30
+      end
+    end
+  end
 end
 
 @r.keys('*').each do |k|
   @r.delete k
-end  
\ No newline at end of file
+end
\ No newline at end of file</diff>
      <filename>bench.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,6 +1,7 @@
 require 'socket'
 require 'set'
 require File.join(File.dirname(__FILE__),'server')
+require File.join(File.dirname(__FILE__),'pipeline')
 
 
 class RedisError &lt; StandardError
@@ -25,6 +26,12 @@ class Redis
     @server = Server.new(@opts[:host], @opts[:port])
   end
   
+  def pipelined
+    pipeline = Pipeline.new(self)
+    yield pipeline
+    pipeline.finish
+  end
+  
   def to_s
     &quot;#{host}:#{port}&quot;
   end
@@ -476,6 +483,14 @@ class Redis
     buff[0..-3]
   end
   
+  def read_socket
+    with_socket_management(@server) do |socket|
+      while res = socket.read(8096)
+        break if res.size != 8096
+      end
+    end
+  end
+  
   def read_proto
     with_socket_management(@server) do |socket|
       if res = socket.gets</diff>
      <filename>lib/redis.rb</filename>
    </modified>
    <modified>
      <diff>@@ -374,4 +374,15 @@ describe &quot;redis&quot; do
     end
   end
 
-end
+  it &quot;should be able to pipeline writes&quot; do
+    @r.pipelined do |pipeline|
+      pipeline.push_head &quot;list&quot;, &quot;hello&quot;
+      pipeline.push_head &quot;list&quot;, 42
+    end
+    
+    @r.type?('list').should == &quot;list&quot;
+    @r.list_length('list').should == 2
+    @r.pop_head('list').should == '42'
+    @r.delete('list')
+  end
+end
\ No newline at end of file</diff>
      <filename>spec/redis_spec.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>8e9dcfc3ae3f3b32d66798e81f79c960c9ba8ca6</id>
    </parent>
  </parents>
  <author>
    <name>Bryan Helmkamp</name>
    <email>bryan@brynary.com</email>
  </author>
  <url>http://github.com/brynary/redis-rb/commit/5f07d2570666abe6315ef4e350428eabac0e09a5</url>
  <id>5f07d2570666abe6315ef4e350428eabac0e09a5</id>
  <committed-date>2009-04-28T16:13:08-07:00</committed-date>
  <authored-date>2009-04-17T14:37:14-07:00</authored-date>
  <message>Add simple pipelining for writes (doesn't check responses)

Signed-off-by: ezmobius &lt;ez@engineyard.com&gt;</message>
  <tree>9b1d709e51866ff8f418cc4a71c5d833cc4ecd84</tree>
  <committer>
    <name>ezmobius</name>
    <email>ez@engineyard.com</email>
  </committer>
</commit>
