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:
Sam Saffron
2019-11-27 12:35:14 +11:00
parent 0807751390
commit 0fb497eb23
11 changed files with 102 additions and 15 deletions

View File

@ -800,7 +800,7 @@ describe SiteSettingExtension do
it 'expires the cache' do
settings.default_locale = 'zh_CN'
expect(Rails.cache.exist?(SiteSettingExtension.client_settings_cache_key)).to be_falsey
expect(Discourse.cache.exist?(SiteSettingExtension.client_settings_cache_key)).to be_falsey
end
it 'refreshes the client' do