PERF: Defer setting of distributed cache in category.

See follow up commit for rational.

Follow-up to 8cfe203
This commit is contained in:
Alan Guo Xiang Tan 2021-06-04 10:32:13 +08:00
parent 9625208f40
commit 982eaab9b0
1 changed files with 3 additions and 1 deletions

View File

@ -735,7 +735,9 @@ class Category < ActiveRecord::Base
end
def url
@@url_cache[self.id] ||= "#{Discourse.base_path}/c/#{slug_path.join('/')}/#{self.id}"
@@url_cache.defer_get_set(self.id) do
"#{Discourse.base_path}/c/#{slug_path.join('/')}/#{self.id}"
end
end
def url_with_id