instance method
should_compress?
Ruby on Rails 3.0.20
Since v3.0.20 Last seen in v3.2.22.5 PrivateSignature
should_compress?(value, options)
No documentation comment.
Parameters
-
valuereq -
optionsreq
Source
# File activesupport/lib/active_support/cache.rb, line 626
def should_compress?(value, options)
if options[:compress] && value
unless value.is_a?(Numeric)
compress_threshold = options[:compress_threshold] || DEFAULT_COMPRESS_LIMIT
serialized_value = value.is_a?(String) ? value : Marshal.dump(value)
return true if serialized_value.size >= compress_threshold
end
end
false
end
Defined in activesupport/lib/active_support/cache.rb line 626
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveSupport::Cache::Entry