mirror of
https://github.com/discourse/discourse.git
synced 2025-09-07 12:02:53 +08:00
PERF: Defer setting of distributed cache in more spots.
See follow up commit for rational.
Follow-up to 8cfe203383
This commit is contained in:
parent
cd9941e0ca
commit
a8667b5454
6 changed files with 16 additions and 18 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue