1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Only dup local cache values if duplicable [#1653 state:resolved]

This commit is contained in:
Joshua Peek 2009-01-28 21:20:46 -06:00
parent a1a9889b06
commit 2e69db18ce
2 changed files with 13 additions and 1 deletions

View file

@ -41,7 +41,7 @@ module ActiveSupport
value
else
# forcing the value to be immutable
value.dup
value.duplicable? ? value.dup : value
end
end

View file

@ -81,6 +81,11 @@ module CacheStoreBehavior
assert_equal({:a => "b"}, @cache.read('foo'))
end
def test_should_read_and_write_integer
@cache.write('foo', 1)
assert_equal 1, @cache.read('foo')
end
def test_should_read_and_write_nil
@cache.write('foo', nil)
assert_equal nil, @cache.read('foo')
@ -200,6 +205,13 @@ uses_memcached 'memcached backed store' do
end
end
def test_local_cache_should_read_and_write_integer
@cache.with_local_cache do
@cache.write('foo', 1)
assert_equal 1, @cache.read('foo')
end
end
def test_local_cache_of_delete
@cache.with_local_cache do
@cache.write('foo', 'bar')