Rename cache-key in ReactionsController (#19368)

* Update ReactionsController#cached_user_public_comment_actions cache_key

* Change cached_user_public_comment_reactions main key naming
This commit is contained in:
Robert Chang 2023-04-27 22:26:57 +08:00 committed by GitHub
parent 2c759ca4dc
commit 8b1a825397
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -57,7 +57,7 @@ class ReactionsController < ApplicationController
end
def cached_user_public_comment_reactions(user, comment_ids)
cache = Rails.cache.fetch("cached-user-#{user.id}-reaction-ids-#{user.public_reactions_count}",
cache = Rails.cache.fetch("#{user.cache_key}/public-comment-reactions-#{user.public_reactions_count}",
expires_in: 24.hours) do
user.reactions.public_category.where(reactable_type: "Comment").each_with_object({}) do |r, h|
h[r.reactable_id] = r.attributes