Add ActiveSupport::Cache::MemCacheStore#inspect

Make the output more readable.
This is a follow up of https://github.com/rails/rails/pull/47944
This commit is contained in:
Guillermo Iguaran 2023-04-19 21:02:32 -07:00
parent 02c1b7ac48
commit c2ec6e7b88

@ -131,14 +131,19 @@ def initialize(*addresses)
MSG
@data = addresses.first
else
mem_cache_options = options.dup
@mem_cache_options = options.dup
# The value "compress: false" prevents duplicate compression within Dalli.
mem_cache_options[:compress] = false
(OVERRIDDEN_OPTIONS - %i(compress)).each { |name| mem_cache_options.delete(name) }
@data = self.class.build_mem_cache(*(addresses + [mem_cache_options]))
@mem_cache_options[:compress] = false
(OVERRIDDEN_OPTIONS - %i(compress)).each { |name| @mem_cache_options.delete(name) }
@data = self.class.build_mem_cache(*(addresses + [@mem_cache_options]))
end
end
def inspect
instance = @data || @mem_cache_options
"#<#{self.class} options=#{options.inspect} mem_cache=#{instance.inspect}>"
end
##
# :method: write
# :call-seq: write(name, value, options = nil)