Move cached_followed_tags to redis (#4714)

This commit is contained in:
jeffin sam 2019-11-05 20:04:58 +05:30 committed by Ben Halpern
parent 71b144da8d
commit 2569a0ac3d

View file

@ -2,7 +2,7 @@ class UserDecorator < ApplicationDecorator
delegate_all
def cached_followed_tags
Rails.cache.fetch("user-#{id}-#{updated_at}/followed_tags_11-30", expires_in: 20.hours) do
RedisRailsCache.fetch("user-#{id}-#{updated_at}/followed_tags_11-30", expires_in: 20.hours) do
follows_query = Follow.where(follower_id: id, followable_type: "ActsAsTaggableOn::Tag").pluck(:followable_id, :points)
tags = Tag.where(id: follows_query.map { |f| f[0] }).order("hotness_score DESC")
tags.each do |t|