diff --git a/app/services/cache/v2/project_date_rank_service.rb b/app/services/cache/v2/project_date_rank_service.rb index 2ada442a8..9df69bbb4 100644 --- a/app/services/cache/v2/project_date_rank_service.rb +++ b/app/services/cache/v2/project_date_rank_service.rb @@ -67,5 +67,9 @@ class Cache::V2::ProjectDateRankService < ApplicationService end $redis_cache.zscore(project_rank_key, @project_id) + + # 设置过期时间(一个月) + $redis_cache.expireat(project_rank_key, (@rank_date+30.days).to_time.to_i) + $redis_cache.expireat(project_rank_statistic_key, (@rank_date+30.days).to_time.to_i) end end \ No newline at end of file diff --git a/app/services/cache/v2/user_date_rank_service.rb b/app/services/cache/v2/user_date_rank_service.rb index a3351b724..b669e4d67 100644 --- a/app/services/cache/v2/user_date_rank_service.rb +++ b/app/services/cache/v2/user_date_rank_service.rb @@ -115,5 +115,9 @@ class Cache::V2::UserDateRankService < ApplicationService $redis_cache.zadd(user_rank_key, score-300, @user_id) if score > 300 $redis_cache.zscore(user_rank_key, @user_id) + + # 设置过期时间(一个月) + $redis_cache.expireat(user_rank_key, (@rank_date+30.days).to_time.to_i) + $redis_cache.expireat(user_date_statistic_key, (@rank_date+30.days).to_time.to_i) end end \ No newline at end of file