mirror of
https://github.com/discourse/discourse.git
synced 2025-06-05 08:07:17 +08:00
DEV: use Discourse.cache over Rails.cache
Discourse.cache is a more consistent method to use and offers clean fallback if you are skipping redis This is part of a larger change that both optimizes Discoruse.cache and omits use of setex on $redis in favor of consistently using discourse cache Bench does reveal that use of Rails.cache and Discourse.cache is 1.25x slower than redis.setex / get so a re-implementation will follow prior to porting
This commit is contained in:
@ -192,7 +192,7 @@ module SiteSettingExtension
|
||||
end
|
||||
|
||||
def client_settings_json
|
||||
Rails.cache.fetch(SiteSettingExtension.client_settings_cache_key, expires_in: 30.minutes) do
|
||||
Discourse.cache.fetch(SiteSettingExtension.client_settings_cache_key, expires_in: 30.minutes) do
|
||||
client_settings_json_uncached
|
||||
end
|
||||
end
|
||||
@ -432,7 +432,7 @@ module SiteSettingExtension
|
||||
protected
|
||||
|
||||
def clear_cache!
|
||||
Rails.cache.delete(SiteSettingExtension.client_settings_cache_key)
|
||||
Discourse.cache.delete(SiteSettingExtension.client_settings_cache_key)
|
||||
Site.clear_anon_cache!
|
||||
end
|
||||
|
||||
|
Reference in New Issue
Block a user