mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
DEV: Make every DistributedCache lazily instantiated (#23147)
This commit is contained in:
committed by
GitHub
parent
87ebbec9b2
commit
91f560a521
@@ -10,7 +10,9 @@ class Theme < ActiveRecord::Base
|
||||
|
||||
attr_accessor :child_components
|
||||
|
||||
@cache = DistributedCache.new("theme:compiler:#{BASE_COMPILER_VERSION}")
|
||||
def self.cache
|
||||
@cache ||= DistributedCache.new("theme:compiler:#{BASE_COMPILER_VERSION}")
|
||||
end
|
||||
|
||||
belongs_to :user
|
||||
belongs_to :color_scheme
|
||||
@@ -202,7 +204,7 @@ class Theme < ActiveRecord::Base
|
||||
end
|
||||
|
||||
def self.get_set_cache(key, &blk)
|
||||
@cache.defer_get_set(key, &blk)
|
||||
cache.defer_get_set(key, &blk)
|
||||
end
|
||||
|
||||
def self.theme_ids
|
||||
@@ -369,7 +371,7 @@ class Theme < ActiveRecord::Base
|
||||
end
|
||||
|
||||
def self.clear_cache!
|
||||
@cache.clear
|
||||
cache.clear
|
||||
end
|
||||
|
||||
def self.targets
|
||||
|
||||
Reference in New Issue
Block a user