From 9918118a97c91742d94a0e677603f2e3301eebdc Mon Sep 17 00:00:00 2001 From: Jeremy Daer Date: Tue, 19 Apr 2016 10:59:37 -0700 Subject: Ensure Cache#inspect doesn't block concurrent cache writes Object#inspect recursively inspects instance variables, exposing all internal state, including sensitive internal cache objects. Override Cache#inspect to give a high-level summary that never interferes with concurrent cache writes. --- actionview/lib/action_view/template/resolver.rb | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'actionview/lib/action_view/template/resolver.rb') diff --git a/actionview/lib/action_view/template/resolver.rb b/actionview/lib/action_view/template/resolver.rb index f33acc2103..c5e69b1833 100644 --- a/actionview/lib/action_view/template/resolver.rb +++ b/actionview/lib/action_view/template/resolver.rb @@ -55,6 +55,10 @@ module ActionView @query_cache = SmallCache.new end + def inspect + "#<#{self.class.name}:0x#{(object_id << 1).to_s(16)} keys=#{@data.size} queries=#{@query_cache.size}>" + end + # Cache the templates returned by the block def cache(key, name, prefix, partial, locals) if Resolver.caching? -- cgit v1.2.3