diff options
author | Richard Schneeman <richard.schneeman+no-recruiters@gmail.com> | 2018-08-29 10:44:33 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-29 10:44:33 -0700 |
commit | 0d63712fdf8c1ccdd9e9e4300b36f0830d1259a0 (patch) | |
tree | d6a3528bc9ab059f34595b1202d513bfed146686 | |
parent | 0d0f48a20a5885c51b4f5c32d039f10960515f4f (diff) | |
parent | e92adb3da6fef3388cc79abb03bf751baac8b2f0 (diff) | |
download | rails-0d63712fdf8c1ccdd9e9e4300b36f0830d1259a0.tar.gz rails-0d63712fdf8c1ccdd9e9e4300b36f0830d1259a0.tar.bz2 rails-0d63712fdf8c1ccdd9e9e4300b36f0830d1259a0.zip |
Merge pull request #33749 from schneems/schneems/faster-fragment
Fewer allocations in caching/fragments.rb
-rw-r--r-- | actionpack/lib/abstract_controller/caching/fragments.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/actionpack/lib/abstract_controller/caching/fragments.rb b/actionpack/lib/abstract_controller/caching/fragments.rb index febd8a67a6..95078a2a28 100644 --- a/actionpack/lib/abstract_controller/caching/fragments.rb +++ b/actionpack/lib/abstract_controller/caching/fragments.rb @@ -88,7 +88,11 @@ module AbstractController def combined_fragment_cache_key(key) head = self.class.fragment_cache_keys.map { |k| instance_exec(&k) } tail = key.is_a?(Hash) ? url_for(key).split("://").last : key - [ :views, (ENV["RAILS_CACHE_ID"] || ENV["RAILS_APP_VERSION"]), *head, *tail ].compact + + cache_key = [:views, ENV["RAILS_CACHE_ID"] || ENV["RAILS_APP_VERSION"], head, tail] + cache_key.flatten!(1) + cache_key.compact! + cache_key end # Writes +content+ to the location signified by |