Expire Frequently Updated Cache Keys Sooner (#4793) [deploy]

This commit is contained in:
Molly Struve 2019-11-12 13:39:50 -06:00 committed by GitHub
parent af04fd7959
commit 57250ade63
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -241,8 +241,8 @@ class User < ApplicationRecord
def cached_following_users_ids
RedisRailsCache.fetch(
"user-#{id}-#{updated_at}-#{following_users_count}/following_users_ids",
expires_in: 120.hours,
"user-#{id}-#{last_followed_at}-#{following_users_count}/following_users_ids",
expires_in: 12.hours,
) do
Follow.where(follower_id: id, followable_type: "User").limit(150).pluck(:followable_id)
end
@ -250,8 +250,8 @@ class User < ApplicationRecord
def cached_following_organizations_ids
RedisRailsCache.fetch(
"user-#{id}-#{updated_at}-#{following_orgs_count}/following_organizations_ids",
expires_in: 120.hours,
"user-#{id}-#{last_followed_at}-#{following_orgs_count}/following_organizations_ids",
expires_in: 12.hours,
) do
Follow.where(follower_id: id, followable_type: "Organization").limit(150).pluck(:followable_id)
end
@ -259,8 +259,8 @@ class User < ApplicationRecord
def cached_following_podcasts_ids
RedisRailsCache.fetch(
"user-#{id}-#{updated_at}-#{last_followed_at}/following_podcasts_ids",
expires_in: 120.hours,
"user-#{id}-#{last_followed_at}/following_podcasts_ids",
expires_in: 12.hours,
) do
Follow.where(follower_id: id, followable_type: "Podcast").pluck(:followable_id)
end