mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
PERF: use distributed cache for site text and category slugs
This commit is contained in:
@@ -1,18 +1,16 @@
|
||||
require_dependency 'site_text_type'
|
||||
require_dependency 'site_text_class_methods'
|
||||
require_dependency 'distributed_cache'
|
||||
|
||||
class SiteText < ActiveRecord::Base
|
||||
|
||||
# needed for site text class methods
|
||||
@mutex = Mutex.new
|
||||
@text_for_cache = {}
|
||||
extend SiteTextClassMethods
|
||||
self.primary_key = 'text_type'
|
||||
|
||||
validates_presence_of :value
|
||||
|
||||
after_save do
|
||||
MessageBus.publish '/text_for', self.text_type
|
||||
SiteText.text_for_cache.clear
|
||||
end
|
||||
|
||||
def self.formats
|
||||
|
||||
Reference in New Issue
Block a user