aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/cache/strategy/local_cache.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activesupport/lib/active_support/cache/strategy/local_cache.rb')
-rw-r--r--activesupport/lib/active_support/cache/strategy/local_cache.rb21
1 files changed, 6 insertions, 15 deletions
diff --git a/activesupport/lib/active_support/cache/strategy/local_cache.rb b/activesupport/lib/active_support/cache/strategy/local_cache.rb
index ec2e96a106..672eb2bb80 100644
--- a/activesupport/lib/active_support/cache/strategy/local_cache.rb
+++ b/activesupport/lib/active_support/cache/strategy/local_cache.rb
@@ -70,6 +70,7 @@ module ActiveSupport
def with_local_cache
use_temporary_local_cache(LocalStore.new) { yield }
end
+
# Middleware class can be inserted as a Rack handler to be local cache for the
# duration of request.
def middleware
@@ -104,8 +105,8 @@ module ActiveSupport
value
end
- protected
- def read_entry(key, options) # :nodoc:
+ private
+ def read_entry(key, options)
if cache = local_cache
cache.fetch_entry(key) { super }
else
@@ -113,25 +114,17 @@ module ActiveSupport
end
end
- def write_entry(key, entry, options) # :nodoc:
+ def write_entry(key, entry, options)
local_cache.write_entry(key, entry, options) if local_cache
super
end
- def delete_entry(key, options) # :nodoc:
+ def delete_entry(key, options)
local_cache.delete_entry(key, options) if local_cache
super
end
- 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` instead.
- MESSAGE
- write_cache_value name, value, options
- end
-
- def write_cache_value(name, value, options) # :nodoc:
+ def write_cache_value(name, value, options)
name = normalize_key(name, options)
cache = local_cache
cache.mute do
@@ -143,8 +136,6 @@ module ActiveSupport
end
end
- private
-
def local_cache_key
@local_cache_key ||= "#{self.class.name.underscore}_local_cache_#{object_id}".gsub(/[\/-]/, "_").to_sym
end