DEV: Make category subcategory_ids cache work like other caches (#20815)

This commit is contained in:
Daniel Waterworth 2023-03-27 09:23:23 -05:00 committed by GitHub
parent b2554e1490
commit 3e80ab3143
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -218,7 +218,7 @@ class Category < ActiveRecord::Base
@@subcategory_ids = DistributedCache.new("subcategory_ids")
def self.subcategory_ids(category_id)
@@subcategory_ids[category_id] ||= begin
@@subcategory_ids.defer_get_set(category_id.to_s) do
sql = <<~SQL
WITH RECURSIVE subcategories AS (
SELECT :category_id id, 1 depth