class ActionView::Resolver::Cache
:nodoc:
Threadsafe template cache
def cache(key, name, prefix, partial, locals)
def cache(key, name, prefix, partial, locals) @data[key][name][prefix][partial][locals] ||= canonical_no_templates(yield) end
def cache_query(query) # :nodoc:
def cache_query(query) # :nodoc: @query_cache[query] ||= canonical_no_templates(yield) end
def canonical_no_templates(templates)
def canonical_no_templates(templates) templates.empty? ? NO_TEMPLATES : templates end
def clear
def clear @data.clear @query_cache.clear end
def initialize
def initialize @data = SmallCache.new(&KEY_BLOCK) @query_cache = SmallCache.new end
def inspect
def inspect "#{to_s[0..-2]} keys=#{@data.size} queries=#{@query_cache.size}>" end
def size # :nodoc:
method. This method is not guaranteed to be here ever.
Get the cache size. Do not call this
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