mirror of
https://github.com/discourse/discourse.git
synced 2025-03-24 06:42:37 +08:00
DEV: make developer cache work like other caches (#20817)
This commit is contained in:
parent
05174a6abd
commit
0f4bb19524
@ -9,11 +9,11 @@ class Developer < ActiveRecord::Base
|
|||||||
@id_cache = DistributedCache.new("developer_ids")
|
@id_cache = DistributedCache.new("developer_ids")
|
||||||
|
|
||||||
def self.user_ids
|
def self.user_ids
|
||||||
@id_cache["ids"] || rebuild_cache
|
@id_cache.defer_get_set("ids") { Set.new(Developer.pluck(:user_id)) }
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.rebuild_cache
|
def self.rebuild_cache
|
||||||
@id_cache["ids"] = Set.new(Developer.pluck(:user_id))
|
@id_cache.clear
|
||||||
end
|
end
|
||||||
|
|
||||||
def rebuild_cache
|
def rebuild_cache
|
||||||
|
Loading…
x
Reference in New Issue
Block a user