mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Avoid building full path objects when cached
This commit is contained in:
parent
4db7ae52f8
commit
bb5208692a
1 changed files with 3 additions and 7 deletions
|
@ -122,16 +122,12 @@ module ActionView
|
||||||
|
|
||||||
private
|
private
|
||||||
def _find_all(name, prefix, partial, details, key, locals)
|
def _find_all(name, prefix, partial, details, key, locals)
|
||||||
path = TemplatePath.build(name, prefix, partial)
|
|
||||||
requested_details = key || TemplateDetails::Requested.new(**details)
|
requested_details = key || TemplateDetails::Requested.new(**details)
|
||||||
query(path, requested_details, locals, cache: !!key)
|
cache = key ? @unbound_templates : Concurrent::Map.new
|
||||||
end
|
|
||||||
|
|
||||||
def query(path, requested_details, locals, cache:)
|
|
||||||
cache = cache ? @unbound_templates : Concurrent::Map.new
|
|
||||||
|
|
||||||
unbound_templates =
|
unbound_templates =
|
||||||
cache.compute_if_absent(path.virtual) do
|
cache.compute_if_absent(TemplatePath.virtual(name, prefix, partial)) do
|
||||||
|
path = TemplatePath.build(name, prefix, partial)
|
||||||
unbound_templates_from_path(path)
|
unbound_templates_from_path(path)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue