Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Revert "Properly cache value when it is "false""

This reverts commit 551f313.

Reason: see
#2010 (comment)
  • Loading branch information...
commit e52dc331d16dd7a3b13383e21fba5cef5b228b9c 1 parent b015d92
Jon Leighton jonleighton authored
4 activesupport/lib/active_support/cache.rb
View
@@ -555,7 +555,7 @@ def initialize(value, options = {})
@expires_in = options[:expires_in]
@expires_in = @expires_in.to_f if @expires_in
@created_at = Time.now.to_f
- if defined?(value)
+ if value
if should_compress?(value, options)
@value = Zlib::Deflate.deflate(Marshal.dump(value))
@compressed = true
@@ -574,7 +574,7 @@ def raw_value
# Get the value stored in the cache.
def value
- if defined?(@value)
+ if @value
val = compressed? ? Marshal.load(Zlib::Inflate.inflate(@value)) : @value
unless val.frozen?
val.freeze rescue nil
5 activesupport/test/caching_test.rb
View
@@ -188,11 +188,6 @@ def test_should_read_and_write_nil
assert_equal nil, @cache.read('foo')
end
- def test_should_read_and_write_false
- assert_equal true, @cache.write('foo', false)
- assert_equal false, @cache.read('foo')
- end
-
def test_read_multi
@cache.write('foo', 'bar')
@cache.write('fu', 'baz')
Please sign in to comment.
Something went wrong with that request. Please try again.