method
should_compress?
v3.1.0 -
Show latest stable
- Class:
ActiveSupport::Cache::Entry
should_compress?(value, options)private
No documentation available.
# File activesupport/lib/active_support/cache.rb, line 623
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