diff --git a/activesupport/lib/active_support/cache.rb b/activesupport/lib/active_support/cache.rb index edd52a15926e9..7fdb0bbd2e073 100644 --- a/activesupport/lib/active_support/cache.rb +++ b/activesupport/lib/active_support/cache.rb @@ -845,7 +845,9 @@ def expires_at=(value) end end - def bytesize # :nodoc: + # Returns the size of the cached value. This could be less than + # value.bytesize if the data is compressed. + def bytesize case value when NilClass 0