<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -118,7 +118,7 @@ class MemCache
   # Other options are ignored.
 
   def initialize(*args)
-    servers = []
+    servers = (ENV[&quot;MEMCACHE_SERVERS&quot;] || &quot;&quot;).split(&quot;,&quot;)
     opts = {}
 
     case args.length
@@ -138,7 +138,7 @@ class MemCache
     end
 
     opts = DEFAULT_OPTIONS.merge opts
-    @namespace   = opts[:namespace]
+    @namespace   = ENV[&quot;MEMCACHE_NAMESPACE&quot;] || opts[:namespace]
     @readonly    = opts[:readonly]
     @multithread = opts[:multithread]
     @timeout     = opts[:timeout]</diff>
      <filename>lib/memcache.rb</filename>
    </modified>
    <modified>
      <diff>@@ -114,6 +114,8 @@ class TestMemCache &lt; Test::Unit::TestCase
 
   def setup
     @cache = MemCache.new 'localhost:1', :namespace =&gt; 'my_namespace'
+    ENV[&quot;MEMCACHE_SERVERS&quot;] = nil
+    ENV[&quot;MEMCACHE_NAMESPACE&quot;] = nil
   end
 
   def test_performance
@@ -362,6 +364,37 @@ class TestMemCache &lt; Test::Unit::TestCase
     assert passed
   end
 
+  def test_initialize_from_ENV
+    ENV[&quot;MEMCACHE_SERVERS&quot;] = &quot;localhost:1234&quot;
+
+    cache = MemCache.new
+
+    assert_equal nil, cache.namespace
+    assert_equal false, cache.readonly?
+    assert_equal 1, cache.servers.size
+  end
+
+  def test_initialize_multi_from_ENV
+    ENV[&quot;MEMCACHE_SERVERS&quot;] = &quot;localhost:1234,localhost:5467&quot;
+
+    cache = MemCache.new
+
+    assert_equal nil, cache.namespace
+    assert_equal false, cache.readonly?
+    assert_equal 2, cache.servers.size
+  end
+
+  def test_initialize_from_ENV_with_namespace
+    ENV[&quot;MEMCACHE_SERVERS&quot;] = &quot;localhost:1234&quot;
+    ENV[&quot;MEMCACHE_NAMESPACE&quot;] = &quot;foobar&quot;
+
+    cache = MemCache.new
+
+    assert_equal &quot;foobar&quot;, cache.namespace
+    assert_equal false, cache.readonly?
+    assert_equal 1, cache.servers.size
+  end
+
   def test_initialize
     cache = MemCache.new :namespace =&gt; 'my_namespace', :readonly =&gt; true
 </diff>
      <filename>test/test_mem_cache.rb</filename>
    </modified>
  </modified>
  <removed type="array">
    <removed>
      <filename>test/test_benchmark.rb</filename>
    </removed>
  </removed>
  <parents type="array">
    <parent>
      <id>d5ae15d362c379c3a6692e2d5b9beae545392cba</id>
    </parent>
  </parents>
  <author>
    <name>Blake Mizerany</name>
    <email>blake.mizerany@gmail.com</email>
  </author>
  <url>http://github.com/bmizerany/memcache-client/commit/c41101539773622294840122f30f85b2a5af3bc6</url>
  <id>c41101539773622294840122f30f85b2a5af3bc6</id>
  <committed-date>2009-04-30T15:28:41-07:00</committed-date>
  <authored-date>2009-04-30T15:28:41-07:00</authored-date>
  <message>Default to using MEMCACHE_SERVERS and MEMCACHE_NAMESPACE

MEMCACHE_SERVERS is a comma seperated list of servers:

export MEMCACHE_SERVERS=localhost:1234,localhost:5678
export MEMCACHE_NAMESPACE=foobar</message>
  <tree>7be4714f0bea9d36eb6182d7d45e443ec7efa30c</tree>
  <committer>
    <name>Blake Mizerany</name>
    <email>blake.mizerany@gmail.com</email>
  </committer>
</commit>
