Add missing expire times to cache keys

This commit is contained in:
Andreas Nedbal 2024-01-25 21:15:04 +01:00 committed by Andreas Nedbal
parent c3d14c6786
commit 134c575e40
4 changed files with 4 additions and 4 deletions

View File

@ -6,7 +6,7 @@ module User::BanMethods
end
def banned?
Rails.cache.fetch("#{cache_key}/banned") do
Rails.cache.fetch("#{cache_key}/banned", expires_in: 6.hours) do
bans.current.count.positive?
end
end

View File

@ -14,7 +14,7 @@ module User::InboxMethods
end
def unread_inbox_count
Rails.cache.fetch(inbox_cache_key) do
Rails.cache.fetch(inbox_cache_key, expires_in: 12.hours) do
count = Inbox.where(new: true, user_id: id).count(:id)
# Returning +nil+ here in order to not display a counter

View File

@ -2,7 +2,7 @@
module User::NotificationMethods
def unread_notification_count
Rails.cache.fetch(notification_cache_key) do
Rails.cache.fetch(notification_cache_key, expires_in: 12.hours) do
count = Notification.for(self).where(new: true).count(:id)
# Returning +nil+ here in order to not display a counter

View File

@ -26,7 +26,7 @@
= render "navigation/icons/notifications", notification_count:
.dropdown-menu.dropdown-menu-end.notification-dropdown
%turbo-frame#notifications-dropdown-list
- cache current_user.notification_dropdown_cache_key do
- cache current_user.notification_dropdown_cache_key, expires_in: 12.hours do
- notifications = Notification.for(current_user).where(new: true).includes([:target]).limit(4)
= render "navigation/dropdown/notifications", notifications:, size: "desktop"
%li.nav-item.d-none.d-sm-block{ data: { bs_toggle: 'tooltip', bs_placement: 'bottom' }, title: t('.ask_question') }