diff options
author | Michael Grosser <michael@grosser.it> | 2015-11-18 12:16:01 -0800 |
---|---|---|
committer | Michael Grosser <michael@grosser.it> | 2015-11-19 20:49:37 -0800 |
commit | a8f773b05734b9a798ae9755d280ef95004ec711 (patch) | |
tree | a4e2f1bd6870dab03b3cb712ae35da482f427d9f /activesupport/lib/active_support/cache | |
parent | 3d8a7c0e64fef726c22fd64911771cee8c467447 (diff) | |
download | rails-a8f773b05734b9a798ae9755d280ef95004ec711.tar.gz rails-a8f773b05734b9a798ae9755d280ef95004ec711.tar.bz2 rails-a8f773b05734b9a798ae9755d280ef95004ec711.zip |
add deprecations for a smooth transition after #22215
Diffstat (limited to 'activesupport/lib/active_support/cache')
3 files changed, 27 insertions, 3 deletions
diff --git a/activesupport/lib/active_support/cache/file_store.rb b/activesupport/lib/active_support/cache/file_store.rb index 9488b95214..dff2443bc8 100644 --- a/activesupport/lib/active_support/cache/file_store.rb +++ b/activesupport/lib/active_support/cache/file_store.rb @@ -137,6 +137,14 @@ module ActiveSupport File.join(cache_path, DIR_FORMATTER % dir_1, DIR_FORMATTER % dir_2, *fname_paths) end + def key_file_path(key) + ActiveSupport::Deprecation.warn(<<-MESSAGE.strip_heredoc) + `key_file_path` is deprecated and will be removed from Rails 5.1. + Please use `normalize_key` which will return a fully resolved key or nothing. + MESSAGE + key + end + # Translate a file path into a key. def file_path_key(path) fname = path[cache_path.to_s.size..-1].split(File::SEPARATOR, 4).last diff --git a/activesupport/lib/active_support/cache/mem_cache_store.rb b/activesupport/lib/active_support/cache/mem_cache_store.rb index 5eaf68a244..4b0ad37586 100644 --- a/activesupport/lib/active_support/cache/mem_cache_store.rb +++ b/activesupport/lib/active_support/cache/mem_cache_store.rb @@ -195,6 +195,14 @@ module ActiveSupport key end + def escape_key(key) + ActiveSupport::Deprecation.warn(<<-MESSAGE.strip_heredoc) + `escape_key` is deprecated and will be removed from Rails 5.1. + Please use `normalize_key` which will return a fully resolved key or nothing. + MESSAGE + key + end + def deserialize_entry(raw_value) if raw_value entry = Marshal.load(raw_value) rescue raw_value diff --git a/activesupport/lib/active_support/cache/strategy/local_cache.rb b/activesupport/lib/active_support/cache/strategy/local_cache.rb index 46d5c6879d..df38dbcf11 100644 --- a/activesupport/lib/active_support/cache/strategy/local_cache.rb +++ b/activesupport/lib/active_support/cache/strategy/local_cache.rb @@ -93,14 +93,14 @@ module ActiveSupport def increment(name, amount = 1, options = nil) # :nodoc: return super unless local_cache value = bypass_local_cache{super} - set_cache_value(name, value, options) + write_cache_value(name, value, options) value end def decrement(name, amount = 1, options = nil) # :nodoc: return super unless local_cache value = bypass_local_cache{super} - set_cache_value(name, value, options) + write_cache_value(name, value, options) value end @@ -123,7 +123,15 @@ module ActiveSupport super end - def set_cache_value(name, value, options) # :nodoc: + def set_cache_value(value, name, amount, options) # :nodoc: + ActiveSupport::Deprecation.warn(<<-MESSAGE.strip_heredoc) + `set_cache_value` is deprecated and will be removed from Rails 5.1. + Please use `write_cache_value` + MESSAGE + write_cache_value name, value, options + end + + def write_cache_value(name, value, options) # :nodoc: name = normalize_key(name, options) cache = local_cache cache.mute do |