diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2016-05-17 11:28:40 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2016-05-17 11:28:51 -0700 |
commit | d6bac046922fcee05366d26d75349dde70d25f6b (patch) | |
tree | 486bad10a28c4b93bbde0482f3bb6217d0a3e516 /actionview/lib/action_view/template | |
parent | 17f04e446a6b3d5ca457e9666e06ee4eccdfa9c2 (diff) | |
download | rails-d6bac046922fcee05366d26d75349dde70d25f6b.tar.gz rails-d6bac046922fcee05366d26d75349dde70d25f6b.tar.bz2 rails-d6bac046922fcee05366d26d75349dde70d25f6b.zip |
keep layouts + locals from bloating the cache
Using locals will cause layouts to be cached multiple times in the
template cache. This commit removes locals from consideration when
looking up the layout.
Diffstat (limited to 'actionview/lib/action_view/template')
-rw-r--r-- | actionview/lib/action_view/template/resolver.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/actionview/lib/action_view/template/resolver.rb b/actionview/lib/action_view/template/resolver.rb index c5e69b1833..bf68e93c58 100644 --- a/actionview/lib/action_view/template/resolver.rb +++ b/actionview/lib/action_view/template/resolver.rb @@ -88,6 +88,23 @@ module ActionView @query_cache.clear end + # Get the cache size. Do not call this + # method. This method is not guaranteed to be here ever. + def size # :nodoc: + size = 0 + @data.each_value do |v1| + v1.each_value do |v2| + v2.each_value do |v3| + v3.each_value do |v4| + size += v4.size + end + end + end + end + + size + @query_cache.size + end + private def canonical_no_templates(templates) |