lib/active_support/cache.rb in activesupport-6.1.0.rc1 vs lib/active_support/cache.rb in activesupport-6.1.0.rc2

- old
+ new

@@ -322,11 +322,11 @@ options = merged_options(options) key = normalize_key(name, options) entry = nil instrument(:read, name, options) do |payload| - cached_entry = read_entry(key, **options) unless options[:force] + cached_entry = read_entry(key, **options, event: payload) unless options[:force] entry = handle_expired_entry(cached_entry, key, options) entry = nil if entry && entry.mismatched?(normalize_version(name, options)) payload[:super_operation] = :fetch if payload payload[:hit] = !!entry if payload end @@ -356,11 +356,11 @@ options = merged_options(options) key = normalize_key(name, options) version = normalize_version(name, options) instrument(:read, name, options) do |payload| - entry = read_entry(key, **options) + entry = read_entry(key, **options, event: payload) if entry if entry.expired? delete_entry(key, **options) payload[:hit] = false if payload @@ -388,11 +388,11 @@ def read_multi(*names) options = names.extract_options! options = merged_options(options) instrument :read_multi, names, options do |payload| - read_multi_entries(names, **options).tap do |results| + read_multi_entries(names, **options, event: payload).tap do |results| payload[:hits] = results.keys end end end @@ -498,11 +498,11 @@ # # Options are passed to the underlying cache implementation. def exist?(name, options = nil) options = merged_options(options) - instrument(:exist?, name) do - entry = read_entry(normalize_key(name, 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 # Deletes all entries with keys matching the pattern.