instance method
exist?
Ruby on Rails 6.1.7.10
Since v2.2.3Signature
exist?(name, options = nil)
Returns true if the cache contains an entry for the given key.
Options are passed to the underlying cache implementation.
Parameters
-
namereq -
optionsopt = nil
Source
# File activesupport/lib/active_support/cache.rb, line 506
def exist?(name, options = nil)
options = merged_options(options)
instrument(:exist?, name) do |payload|
entry = read_entry(normalize_key(name, options), **options, event: payload)
(entry && !entry.expired? && !entry.mismatched?(normalize_version(name, options))) || false
end
end
Defined in activesupport/lib/active_support/cache.rb line 506
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveSupport::Cache::Store