Skip to content

Commit

Permalink
Ensure Memcache local cache returns duplicated values [#2302 state:re…
Browse files Browse the repository at this point in the history
…solved]
  • Loading branch information
josh committed May 27, 2009
1 parent 9b2a665 commit b4c7b3e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
Expand Up @@ -38,7 +38,7 @@ def read(key, options = nil)
elsif value.nil?
value = super
local_cache.write(key, value || NULL) if local_cache
value
value.duplicable? ? value.dup : value
else
# forcing the value to be immutable
value.duplicable? ? value.dup : value
Expand Down
9 changes: 9 additions & 0 deletions activesupport/test/caching_test.rb
Expand Up @@ -185,6 +185,15 @@ def test_store_objects_should_be_immutable
end
end

def test_stored_objects_should_not_be_frozen
@cache.with_local_cache do
@cache.write('foo', 'bar')
end
@cache.with_local_cache do
assert !@cache.read('foo').frozen?
end
end

def test_write_should_return_true_on_success
@cache.with_local_cache do
result = @cache.write('foo', 'bar')
Expand Down

0 comments on commit b4c7b3e

Please sign in to comment.