instance method
namespace_key
Ruby on Rails 5.2.8.1
Since v5.2.8.1 Private — implementation detail, not part of the public APISignature
namespace_key(key, options = nil)
Prefix the key with a namespace string:
namespace_key 'foo', namespace: 'cache'
# => 'cache:foo'
With a namespace block:
namespace_key 'foo', namespace: -> { 'cache' }
# => 'cache:foo'
Parameters
-
keyreq -
optionsopt = nil
Source
# File activesupport/lib/active_support/cache.rb, line 611
def namespace_key(key, options = nil)
options = merged_options(options)
namespace = options[:namespace]
if namespace.respond_to?(:call)
namespace = namespace.call
end
if namespace
"#{namespace}:#{key}"
else
key
end
end
Defined in activesupport/lib/active_support/cache.rb line 611
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveSupport::Cache::Store