class method
self.expand_cache_key
Ruby on Rails 3.0.20
Since v2.2.3Signature
self.expand_cache_key(key, namespace = nil)
No documentation comment.
Parameters
-
keyreq -
namespaceopt = nil
Source
# File activesupport/lib/active_support/cache.rb, line 77
def self.expand_cache_key(key, namespace = nil)
expanded_cache_key = namespace ? "#{namespace}/" : ""
prefix = ENV["RAILS_CACHE_ID"] || ENV["RAILS_APP_VERSION"]
if prefix
expanded_cache_key << "#{prefix}/"
end
expanded_cache_key <<
if key.respond_to?(:cache_key)
key.cache_key
elsif key.is_a?(Array)
if key.size > 1
key.collect { |element| expand_cache_key(element) }.to_param
else
key.first.to_param
end
elsif key
key.to_param
end.to_s
expanded_cache_key
end
Defined in activesupport/lib/active_support/cache.rb line 77
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveSupport::Cache