1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Generate keys instead of keys_to_names

`keys_to_names` is used only for `keys_to_names.keys`.
This commit is contained in:
Ryuta Kamizono 2017-11-20 01:55:03 +09:00
parent 83cb0fc632
commit 125095c2d5

View file

@ -300,10 +300,10 @@ module ActiveSupport
options = names.extract_options!
options = merged_options(options)
keys_to_names = names.map { |name| [ normalize_key(name, options), name ] }.to_h
values = redis.mget(*keys_to_names.keys)
keys = names.map { |name| normalize_key(name, options) }
values = redis.mget(*keys)
keys_to_names.zip(values).each_with_object({}) do |((_, name), value), results|
names.zip(values).each_with_object({}) do |(name, value), results|
if value
entry = deserialize_entry(value)
unless entry.nil? || entry.expired? || entry.mismatched?(normalize_version(name, options))