DEV: Prefer defer_get_set over get/set on DistributedCache (#25967)

This commit is contained in:
Daniel Waterworth 2024-02-29 11:10:24 -06:00 committed by GitHub
parent 7aa3e15440
commit f0baa0ddfe
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 32 additions and 34 deletions

View File

@ -287,9 +287,7 @@ class Stylesheet::Manager
end
)
stylesheets = cache[array_cache_key]
return stylesheets if stylesheets.present?
cache.defer_get_set(array_cache_key) do
@@lock.synchronize do
stylesheets = []
@ -329,10 +327,10 @@ class Stylesheet::Manager
stylesheets << data
end
cache.defer_set(array_cache_key, stylesheets.freeze)
stylesheets
end
end
end
def color_scheme_stylesheet_details(color_scheme_id = nil, media)
theme_id = @theme_id || SiteSetting.default_theme_id