public
Description: Ruby on Rails
Homepage: http://rubyonrails.org
Clone URL: git://github.com/rails/rails.git
Support options passed to ActiveSupport::Cache :mem_cache_store [#14 
state:resolved]
Signed-off-by: Joshua Peek <josh@joshpeek.com>
jweiss (author)
Thu Apr 17 10:58:31 -0700 2008
josh (committer)
Thu Apr 17 10:58:31 -0700 2008
commit  9e1d506a8cfedef2fdd605e4cbf4bf53651ad214
tree    bb68f6da2b3425008fdab9905555dd813d42756a
parent  9e53b63601ce12fb7e4c8fdb16d5706ea8609d2f
...
15
16
17
 
18
19
20
 
21
22
23
...
15
16
17
18
19
20
 
21
22
23
24
0
@@ -15,9 +15,10 @@ module ActiveSupport
0
 
0
       def initialize(*addresses)
0
         addresses = addresses.flatten
0
+        options = addresses.extract_options!
0
         addresses = ["localhost"] if addresses.empty?
0
         @addresses = addresses
0
-        @data = MemCache.new(addresses)
0
+        @data = MemCache.new(addresses, options)
0
       end
0
 
0
       def read(key, options = nil)
...
18
19
20
 
 
 
 
 
 
 
 
 
 
 
 
 
21
22
23
...
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
0
@@ -18,6 +18,19 @@ class CacheStoreSettingTest < Test::Unit::TestCase
0
     assert_kind_of(ActiveSupport::Cache::MemCacheStore, store)
0
     assert_equal %w(localhost), store.addresses
0
   end
0
+  
0
+  def test_mem_cache_fragment_cache_store_with_multiple_servers
0
+    store = ActiveSupport::Cache.lookup_store :mem_cache_store, "localhost", '192.168.1.1'
0
+    assert_kind_of(ActiveSupport::Cache::MemCacheStore, store)
0
+    assert_equal %w(localhost 192.168.1.1), store.addresses
0
+  end
0
+  
0
+  def test_mem_cache_fragment_cache_store_with_options
0
+    store = ActiveSupport::Cache.lookup_store :mem_cache_store, "localhost", '192.168.1.1', :namespace => 'foo'
0
+    assert_kind_of(ActiveSupport::Cache::MemCacheStore, store)
0
+    assert_equal %w(localhost 192.168.1.1), store.addresses
0
+    assert_equal 'foo', store.instance_variable_get('@data').instance_variable_get('@namespace')
0
+  end
0
 
0
   def test_object_assigned_fragment_cache_store
0
     store = ActiveSupport::Cache.lookup_store ActiveSupport::Cache::FileStore.new("/path/to/cache/directory")

Comments