diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2017-05-19 14:09:09 +0200 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2017-05-19 14:09:09 +0200 |
commit | aa8749eb52d7919a438940c9218cad98d892f9ad (patch) | |
tree | 9802b4c1a29b2d03d50eede3d1cc237505bba69d /activesupport | |
parent | f8b5b4af843cb3107071c7d9fdc0d76bb43c47d6 (diff) | |
download | rails-aa8749eb52d7919a438940c9218cad98d892f9ad.tar.gz rails-aa8749eb52d7919a438940c9218cad98d892f9ad.tar.bz2 rails-aa8749eb52d7919a438940c9218cad98d892f9ad.zip |
Add cache_key_with_version and use it in ActiveSupport::Cache.expand_cache_key
This retains the existing behavior of
ActiveSupport::Cache.expand_cache_key (as used by etaging) where the
cache key includes the version.
Diffstat (limited to 'activesupport')
-rw-r--r-- | activesupport/lib/active_support/cache.rb | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/activesupport/lib/active_support/cache.rb b/activesupport/lib/active_support/cache.rb index 258140fe1d..cea603e1b3 100644 --- a/activesupport/lib/active_support/cache.rb +++ b/activesupport/lib/active_support/cache.rb @@ -88,10 +88,11 @@ module ActiveSupport private def retrieve_cache_key(key) case - when key.respond_to?(:cache_key) then key.cache_key - when key.is_a?(Array) then key.map { |element| retrieve_cache_key(element) }.to_param - when key.respond_to?(:to_a) then retrieve_cache_key(key.to_a) - else key.to_param + when key.respond_to?(:cache_key_with_version) then key.cache_key_with_version + when key.respond_to?(:cache_key) then key.cache_key + when key.is_a?(Array) then key.map { |element| retrieve_cache_key(element) }.to_param + when key.respond_to?(:to_a) then retrieve_cache_key(key.to_a) + else key.to_param end.to_s end |