FIX: Cache keys should be strings (#25791)

* FIX: Cache keys should be strings

Otherwise, there are subtle bugs that don't show up with a single
process.
This commit is contained in:
Daniel Waterworth
2024-02-21 10:55:48 -06:00
committed by GitHub
parent 428db40deb
commit 13291dc5ef
2 changed files with 3 additions and 1 deletions

View File

@ -14,6 +14,8 @@ class DistributedCache < MessageBus::DistributedCache
end
def defer_get_set(k, &block)
raise TypeError if !Rails.env.production? && !k.is_a?(String)
return self[k] if hash.key? k
value = block.call
self.defer_set(k, value)