2024-12-06 10:52:36 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
|
|
class Cache::PreheatingJob < ApplicationJob
|
2025-07-26 19:08:29 -04:00
|
|
|
queue_as :cache
|
2024-12-06 10:52:36 -05:00
|
|
|
|
|
|
|
|
def perform
|
|
|
|
|
User.find_each do |user|
|
2025-01-07 09:02:35 -05:00
|
|
|
Rails.cache.write(
|
|
|
|
|
"dawarich/user_#{user.id}_years_tracked",
|
|
|
|
|
user.years_tracked,
|
|
|
|
|
expires_in: 1.day
|
|
|
|
|
)
|
2025-09-05 13:39:50 -04:00
|
|
|
|
|
|
|
|
Rails.cache.write(
|
|
|
|
|
"dawarich/user_#{user.id}_points_geocoded_stats",
|
2025-09-13 11:04:48 -04:00
|
|
|
StatsQuery.new(user).cached_points_geocoded_stats,
|
2025-09-05 13:39:50 -04:00
|
|
|
expires_in: 1.day
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
Rails.cache.write(
|
|
|
|
|
"dawarich/user_#{user.id}_countries_visited",
|
2025-09-13 11:04:48 -04:00
|
|
|
user.countries_visited_uncached,
|
2025-09-05 13:39:50 -04:00
|
|
|
expires_in: 1.day
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
Rails.cache.write(
|
|
|
|
|
"dawarich/user_#{user.id}_cities_visited",
|
2025-09-13 11:04:48 -04:00
|
|
|
user.cities_visited_uncached,
|
2025-09-05 13:39:50 -04:00
|
|
|
expires_in: 1.day
|
|
|
|
|
)
|
2024-12-06 10:52:36 -05:00
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|