mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Tidy and speed up ActiveSupport::Cache::Store#read_multi_entries
This commit is contained in:
parent
9d9c749a72
commit
77a416c84f
1 changed files with 11 additions and 14 deletions
|
@ -583,24 +583,21 @@ module ActiveSupport
|
|||
# Reads multiple entries from the cache implementation. Subclasses MAY
|
||||
# implement this method.
|
||||
def read_multi_entries(names, **options)
|
||||
results = {}
|
||||
names.each do |name|
|
||||
names.each_with_object({}) do |name, results|
|
||||
key = normalize_key(name, options)
|
||||
version = normalize_version(name, options)
|
||||
entry = read_entry(key, **options)
|
||||
|
||||
if entry
|
||||
next unless entry
|
||||
|
||||
version = normalize_version(name, options)
|
||||
|
||||
if entry.expired?
|
||||
delete_entry(key, **options)
|
||||
elsif entry.mismatched?(version)
|
||||
# Skip mismatched versions
|
||||
else
|
||||
elsif !entry.mismatched?(version)
|
||||
results[name] = entry.value
|
||||
end
|
||||
end
|
||||
end
|
||||
results
|
||||
end
|
||||
|
||||
# Writes multiple entries to the cache implementation. Subclasses MAY
|
||||
# implement this method.
|
||||
|
|
Loading…
Reference in a new issue