diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2018-11-16 15:02:18 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-16 15:02:18 +0100 |
commit | 8069fd636ba14059524303ce76abe2173c4f3d01 (patch) | |
tree | 55dd4f8ecd39813080cb5ddedd834f93a7ffc919 /app/lib/entity_cache.rb | |
parent | 367ad2199509e9008c04c08f3476e236b27b52a1 (diff) |
Remove intermediary arrays when creating hash maps from results (#9291)
Diffstat (limited to 'app/lib/entity_cache.rb')
-rw-r--r-- | app/lib/entity_cache.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/app/lib/entity_cache.rb b/app/lib/entity_cache.rb index 2aa37389c..8fff544a0 100644 --- a/app/lib/entity_cache.rb +++ b/app/lib/entity_cache.rb @@ -21,7 +21,7 @@ class EntityCache end unless uncached_ids.empty? - uncached = CustomEmoji.where(shortcode: shortcodes, domain: domain, disabled: false).map { |item| [item.shortcode, item] }.to_h + uncached = CustomEmoji.where(shortcode: shortcodes, domain: domain, disabled: false).each_with_object({}) { |item, h| h[item.shortcode] = item } uncached.each_value { |item| Rails.cache.write(to_key(:emoji, item.shortcode, domain), item, expires_in: MAX_EXPIRATION) } end |