mirror of
https://github.com/discourse/discourse.git
synced 2025-05-28 13:51:18 +08:00
PERF: Defer setting of distributed cache in more spots.
See follow up commit for rational. Follow-up to 8cfe203383367cc7a3cf31b3c3960b7b7aac92ef
This commit is contained in:
@ -19,4 +19,11 @@ class DistributedCache < MessageBus::DistributedCache
|
||||
self[k] = v
|
||||
end
|
||||
end
|
||||
|
||||
def defer_get_set(k, &block)
|
||||
return self[k] if self[k]
|
||||
value = block.call
|
||||
self.defer_set(k, value)
|
||||
value
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user