Skip to content

缓存结构 ​

本文记录项目当前使用的 Redis / Django cache 结构,以及缓存与数据库、API 之间的读写流向。数据库字段结构以各 app 的 models.py 为准,这里只记录缓存中实际保存的数据结构。

总览 ​

cachecreate_account_link->accountlinkqueue_dbdelete_link->accountlinkqueue_dbdelete_link->accountlinkplatform_dbupdate_link->accountlinkplatform_dbview_saolei_import_one_video->task_dbview_saolei_import_one_video->videosaolei_dbview_saolei_import_one_video->video_dbview_saolei_import_one_video->video_filesview_saolei_import_videos->task_dbenqueue/deleteview_saolei_import_videos->accountlinkplatform_dbview_saolei_import_videos->task_saolei_video_import_bulkenqueuevideo_upload->video_dbvideo_upload->video_filesadd_identifier->custom_pluck_dbadd_identifier->identifier_dbadd_identifier->userms_dbdel_identifier->custom_pluck_dbdel_identifier->identifier_dbdel_identifier->userms_dbset_tournament->tournament_dbcancel_tournament->tournament_dbdelete_participant->participant_dbdelete (parent/subclass)create_gsc_participant->participant_dbregister_gsc_participant_identifier->identifier_dbregister_gsc_participant_identifier->userms_dbregister_gsc_participant_identifier->participant_dbregister_gsc_participant_identifier->video_dbcreate_weekly_participant->participant_dbupdate_user_profile->userprofile_dbupdate_user_avatar->userprofile_dbupdate_user_avatar->avatar_filesuser_retrieve->userprofile_dbuser_retrieve->email_otp_dbuser_register->userprofile_dbuser_register->email_otp_dbrefresh_captcha->captcha_dbget_email_captcha->captcha_dbcaptcha_db->user_logincaptcha_db->refresh_captchacaptcha_db->get_email_captchatask_db->view_saolei_import_one_videotask_db->view_saolei_import_videostask_db->view_saolei_get_import_listtask_db->view_saolei_get_import_summarytask_db->task_summary_cachetask_db->task_saolei_video_import_bulkread/deletetask_db->task_saolei_video_importstatus/readtask_db->task_gsc_finishstatus/readtask_db->task_gsc_refresh_beststatus/readtask_db->task_award_tournamentstatus/readtask_db->task_weekly_finishstatus/readtask_db->task_weekly_refresh_beststatus/readaccountlinkqueue_db->get_account_linksaccountlinkqueue_db->delete_linkaccountlinkplatform_db->get_account_linksaccountlinkplatform_db->update_linkaccountlinkplatform_db->view_saolei_import_one_videoaccountlinkplatform_db->view_saolei_import_videosaccountlinkplatform_db->view_saolei_get_import_listaccountlinkplatform_db->view_saolei_get_import_summaryaccountlinkplatform_db->task_saolei_video_import_bulkreadaccountlinkplatform_db->task_saolei_video_importFK readvideosaolei_db->view_saolei_import_one_videovideosaolei_db->view_saolei_import_videosvideosaolei_db->view_saolei_get_import_listvideosaolei_db->view_saolei_get_import_summaryvideosaolei_db->task_saolei_video_import_bulkread/writevideosaolei_db->task_saolei_video_importreadcustom_pluck_db->refresh_custom_pluck_rank_on_video_savereadcustom_pluck_db->update_custom_pluck_cache_on_record_savepost_savecustom_pluck_db->update_custom_pluck_cache_on_record_deletepost_deleteidentifier_db->get_participant_listidentifier_db->register_gsc_participant_identifieridentifier_db->update_cache_on_participant_saveFK readidentifier_db->task_saolei_video_importreaduserms_db->add_identifieruserms_db->del_identifieruserms_db->get_recordsuserms_db->get_records_abstractuserms_db->get_user_identifieruserms_db->update_user_profileuserms_db->update_user_avataruserms_db->user_loginuserms_db->user_retrieveuserms_db->user_registeruserms_db->update_video_count_on_video_saveO2O readuserms_db->update_video_count_limit_on_video_saveO2O readuserms_db->update_video_count_on_video_deleteO2O readuserms_db->capture_previous_records_for_news_queuepre_saveuserms_db->capture_previous_records_for_news_queuereaduserms_db->push_news_queue_on_record_savepost_saveuserms_db->refresh_personal_record_on_video_saveO2O readuserms_db->refresh_personal_record_on_video_deleteO2O readuserms_db->task_saolei_video_importO2O readtournament_db->get_tournament_listtournament_db->get_tournamenttournament_db->set_tournamenttournament_db->cancel_tournamenttournament_db->get_participant_listtournament_db->delete_participanthost_id read (join)tournament_db->get_participant_videostournament_db->download_all_videostournament_db->download_videos_participanttournament_db->get_gsc_resultstournament_db->create_gsc_participanttournament_db->register_gsc_participant_identifiertournament_db->get_weekly_resultstournament_db->create_weekly_participanttournament_db->update_video_count_on_video_deletem2m existstournament_db->checkin_video_before_createquery readtournament_db->update_cache_on_tournament_deletepost_deletetournament_db->update_cache_on_tournament_savepost_savetournament_db->update_cache_on_tournament_savesubclass readtournament_db->update_cache_on_participant_saveFK/m2m readtournament_db->update_best_score_on_gsc_participant_saveFK/subclass readtournament_db->update_best_score_on_weekly_participant_saveFK/subclass readtournament_db->update_best_score_on_gsc_participant_deleteFK/subclass readtournament_db->update_best_score_on_weekly_participant_deleteFK/subclass readtournament_db->task_gsc_finishread/writetournament_db->task_gsc_refresh_bestreadtournament_db->task_award_tournamentreadtournament_db->task_weekly_finishread/writetournament_db->task_weekly_refresh_bestreadparticipant_db->get_participant_listparticipant_db->delete_participantreadparticipant_db->get_participant_videosparticipant_db->get_gsc_resultsparticipant_db->register_gsc_participant_identifierparticipant_db->get_weekly_resultsparticipant_db->update_cache_on_participant_savepost_saveparticipant_db->update_best_score_on_gsc_participant_savepost_saveparticipant_db->update_best_score_on_weekly_participant_savepost_saveparticipant_db->update_best_score_on_gsc_participant_deletepost_deleteparticipant_db->update_best_score_on_gsc_participant_deletequery bestparticipant_db->update_best_score_on_weekly_participant_deletepost_deleteparticipant_db->update_best_score_on_weekly_participant_deletequery bestparticipant_db->remove_participant_cache_on_deletepost_deleteparticipant_db->task_gsc_finishread/write/deleteparticipant_db->task_gsc_refresh_bestreadparticipant_db->task_award_tournamentread/write rank_scoreparticipant_db->task_weekly_finishread/write/deleteparticipant_db->task_weekly_refresh_bestreadtournament_user_db->update_best_score_on_gsc_participant_saveread/createtournament_user_db->update_best_score_on_weekly_participant_saveread/createtournament_user_db->update_best_score_on_gsc_participant_deletereadtournament_user_db->update_best_score_on_weekly_participant_deletereadtournament_user_db->task_gsc_finishread/decaytournament_user_db->task_gsc_refresh_bestread/write besttournament_user_db->task_award_tournamentread/write scoretournament_user_db->task_weekly_finishread/decaytournament_user_db->task_weekly_refresh_bestread/write bestuserprofile_db->view_saolei_get_import_listuserprofile_db->set_tournamentuserprofile_db->cancel_tournamentuserprofile_db->get_participant_videosuserprofile_db->download_videos_participantuserprofile_db->get_gsc_resultsuserprofile_db->create_gsc_participantuserprofile_db->register_gsc_participant_identifieruserprofile_db->create_weekly_participantuserprofile_db->get_user_infouserprofile_db->get_user_info_bulkuserprofile_db->get_user_info_updateduserprofile_db->get_user_identifieruserprofile_db->get_user_avataruserprofile_db->get_user_videosuserprofile_db->update_user_profileuserprofile_db->update_user_avataruserprofile_db->user_loginuserprofile_db->user_retrieveuserprofile_db->user_registeruserprofile_db->check_collisionuserprofile_db->get_softwareuserprofile_db->video_previewuserprofile_db->video_downloaduserprofile_db->video_queryuserprofile_db->video_query_by_iduserprofile_db->refresh_state_queue_on_video_saveFK readuserprofile_db->update_video_count_on_video_saveFK readuserprofile_db->update_video_count_limit_on_video_saveFK readuserprofile_db->update_video_count_on_video_deleteFK readuserprofile_db->push_news_queue_on_record_savereverse O2O readuserprofile_db->refresh_personal_record_on_video_saveFK/query readuserprofile_db->refresh_personal_record_on_video_deleteFK readuserprofile_db->refresh_custom_pluck_rank_on_video_saveFK readuserprofile_db->task_saolei_video_importO2O reademail_otp_db->user_retrieveemail_otp_db->user_registervideo_db->view_saolei_import_one_videovideo_db->add_identifiervideo_db->del_identifiervideo_db->get_participant_videosvideo_db->download_all_videosvideo_db->download_videos_participantvideo_db->get_user_videosvideo_db->user_loginvideo_db->user_retrievevideo_db->user_registervideo_db->get_review_queuevideo_db->get_video_info_bulkvideo_db->get_video_detail_bulkvideo_db->get_softwarevideo_db->video_previewvideo_db->video_downloadvideo_db->video_queryvideo_db->video_query_by_idvideo_db->disk_usage_cachevideo_db->video_summary_cachevideo_db->capture_video_updatepre_savevideo_db->capture_video_updatereadvideo_db->refresh_state_queue_on_video_savepost_savevideo_db->refresh_state_queue_on_video_saveO2O readvideo_db->update_video_count_on_video_savepost_savevideo_db->update_video_count_limit_on_video_savepost_savevideo_db->update_video_count_on_video_deletepre_deletevideo_db->refresh_personal_record_on_video_savepost_savevideo_db->refresh_personal_record_on_video_saveread/refreshvideo_db->refresh_personal_record_on_video_deletepost_deletevideo_db->refresh_personal_record_on_video_deleteread bestvideo_db->refresh_custom_pluck_rank_on_video_savepost_savevideo_db->refresh_custom_pluck_rank_on_video_saveread bestvideo_db->update_custom_pluck_cache_on_record_saveFK readvideo_db->checkin_video_before_createpre_savevideo_db->checkin_video_before_createO2O readvideo_db->add_created_video_to_checked_tournamentspost_savevideo_db->update_cache_on_participant_savequery readvideo_db->task_saolei_video_importcollision/readvideo_db->task_gsc_finishread/writevideo_db->task_weekly_finishread/writetask_summary_cache->task_summarydisk_usage_cache->disk_usagevideo_summary_cache->video_summarypluck_rank_cache->pluck_rankpluck_rank_cache->player_pluck_recordspluck_detail_cache->pluck_rankpluck_detail_cache->player_pluck_recordsnewest_cache->newest_queuefreeze_cache->freeze_queuenews_cache->news_queuenews_cache->push_news_queue_on_record_saveread sizeplayer_record_cache->player_rankplayer_rank_cache->player_ranktournament_cache->get_tournament_listtournament_cache->get_tournament_newsparticipant_cache->checkin_video_before_createreadparticipant_cache->update_cache_on_tournament_deletescan/readparticipant_cache->update_cache_on_tournament_savescan/readparticipant_cache->update_cache_on_participant_savereadparticipant_cache->remove_participant_cache_on_deletereadvideo_files->view_saolei_import_one_videovideo_files->download_all_videosvideo_files->download_videos_participantvideo_files->video_previewvideo_files->video_downloadvideo_files->task_saolei_video_importreadavatar_files->get_user_avatarrefresh_state_queue_on_video_save->newest_cachewrite/deleterefresh_state_queue_on_video_save->freeze_cachewrite/deleterefresh_state_queue_on_video_save->review_cachewrite/deleteupdate_video_count_on_video_save->userms_dbwriteupdate_video_count_limit_on_video_save->userms_dbwriteupdate_video_count_on_video_delete->userms_dbwritepush_news_queue_on_record_save->news_cachewrite/trimrefresh_personal_record_on_video_save->userms_dbwriterefresh_personal_record_on_video_save->player_record_cachewriterefresh_personal_record_on_video_save->player_rank_cachewriterefresh_personal_record_on_video_delete->userms_dbwriterefresh_personal_record_on_video_delete->player_record_cachewriterefresh_personal_record_on_video_delete->player_rank_cachewriterefresh_custom_pluck_rank_on_video_save->custom_pluck_dbwrite/deleteupdate_custom_pluck_cache_on_record_save->pluck_rank_cachewriteupdate_custom_pluck_cache_on_record_save->pluck_detail_cachewriteupdate_custom_pluck_cache_on_record_delete->pluck_rank_cachedeleteupdate_custom_pluck_cache_on_record_delete->pluck_detail_cachedeletecheckin_video_before_create->video_dbwrite fieldadd_created_video_to_checked_tournaments->tournament_dbm2m writeupdate_cache_on_tournament_delete->tournament_cachedeleteupdate_cache_on_tournament_delete->participant_cachewrite/deleteupdate_cache_on_tournament_save->tournament_cachewrite/deleteupdate_cache_on_tournament_save->participant_cachewrite/deleteupdate_cache_on_participant_save->tournament_dbm2m writeupdate_cache_on_participant_save->participant_cachewrite/deleteupdate_best_score_on_gsc_participant_save->tournament_user_dbwrite bestupdate_best_score_on_weekly_participant_save->tournament_user_dbwrite bestupdate_best_score_on_gsc_participant_delete->tournament_user_dbwrite bestupdate_best_score_on_weekly_participant_delete->tournament_user_dbwrite bestremove_participant_cache_on_delete->participant_cachewrite/deletetask_saolei_video_import_bulk->task_dbenqueue/deletetask_saolei_video_import_bulk->videosaolei_dbwritetask_saolei_video_import_bulk->task_saolei_video_importenqueue eachtask_saolei_video_import->task_dbstatus writetask_saolei_video_import->videosaolei_dbwritetask_saolei_video_import->userms_dbcreatetask_saolei_video_import->video_dbwritetask_saolei_video_import->video_fileswritetask_gsc_finish->tournament_dbstate writetask_gsc_finish->participant_dbscore/rank/awardtask_gsc_finish->tournament_user_dbaward/decaytask_gsc_finish->pluck_rank_cacherestore plucktask_gsc_finish->pluck_detail_cacherestore plucktask_gsc_finish->newest_cacherestore queuestask_gsc_finish->freeze_cacherestore queuestask_gsc_finish->review_cacherestore queuestask_gsc_finish->player_record_cacherestore recordstask_gsc_finish->player_rank_cacherestore recordstask_gsc_finish->task_gsc_refresh_bestenqueuetask_gsc_finish->task_award_tournamentenqueuetask_gsc_refresh_best->tournament_user_rank_cachewrite best zsettask_award_tournament->tournament_user_rank_cachewrite score zsetstask_weekly_finish->tournament_dbstate writetask_weekly_finish->participant_dbscore/rank/awardtask_weekly_finish->tournament_user_dbaward/decaytask_weekly_finish->pluck_rank_cacherestore plucktask_weekly_finish->pluck_detail_cacherestore plucktask_weekly_finish->newest_cacherestore queuestask_weekly_finish->freeze_cacherestore queuestask_weekly_finish->review_cacherestore queuestask_weekly_finish->player_record_cacherestore recordstask_weekly_finish->player_rank_cacherestore recordstask_weekly_finish->task_award_tournamentenqueuetask_weekly_finish->task_weekly_refresh_bestenqueuetask_weekly_refresh_best->tournament_user_rank_cachewrite best zsetget_account_links/api/accountlink/{user_id}create_account_link/api/accountlink/create/delete_link/accountlink/delete/update_link/accountlink/update/view_saolei_import_one_video/accountlink/saolei_import_video/view_saolei_import_videos/accountlink/saolei_import_videos/view_saolei_get_import_list/accountlink/saolei/videolist/get/view_saolei_get_import_summary/accountlink/saolei/videoimport/stat/task_summary/api/common/tasksummarydisk_usage/api/common/diskusagevideo_summary/api/common/videosummaryvideo_upload/common/uploadvideo/pluck_rank/api/customranking/pluckplayer_pluck_records/api/customranking/pluck/playeradd_identifier/identifier/add/del_identifier/identifier/del/get_records/api/msuser/recordsget_records_abstract/api/msuser/records_abstractplayer_rank/msuser/player_rank/get_tournament_list/api/tournament/get_listget_tournament/api/tournament/getset_tournament/api/tournament/setcancel_tournament/api/tournament/cancelget_participant_list/api/tournament/participantsdelete_participantDELETE /api/tournament/participant/{participant_id}get_participant_videos/api/tournament/get_videos/participantget_tournament_news/api/tournament/get_newsdownload_all_videos/api/tournament/downloaddownload_videos_participant/api/tournament/download/participantget_gsc_results/api/tournament/gsc/resultscreate_gsc_participant/api/tournament/gsc/participantregister_gsc_participant_identifier/api/tournament/gsc/participant/identifierget_weekly_results/api/tournament/weekly/resultscreate_weekly_participant/api/tournament/weekly/participantget_user_info/api/userprofile/info/{user_id}get_user_info_bulk/api/userprofile/infobulkget_user_info_updated/api/userprofile/infoupdatedget_user_identifier/api/userprofile/identifierget_user_avatar/api/userprofile/avatar/{user_id}get_user_videos/api/userprofile/videolistupdate_user_profile/api/userprofile/update_profileupdate_user_avatar/api/userprofile/update_avataruser_login/userprofile/login/user_retrieve/userprofile/retrieve/user_register/userprofile/register/check_collision/userprofile/checkcollision/refresh_captcha/userprofile/refresh_captcha/get_email_captcha/userprofile/get_email_captcha/get_review_queue/api/video/review_queueget_video_info_bulk/api/video/infobulkget_video_detail_bulk/api/video/detailbulkget_software/video/get_software/video_preview/video/preview/video_download/video/download/video_query/video/query/video_query_by_id/video/query_by_id/newest_queue/video/newest_queue/news_queue/video/news_queue/freeze_queue/video/freeze_queue/captcha_dbCaptchaStoretask_dbDBTaskResultaccountlinkqueue_dbAccountLinkQueueplatform accountsaccountlinkplatform_dbAccountSaoleiAccountMinesweeperGamesAccountBilibiliAccountWorldOfMinesweeperAccountQQvideosaolei_dbVideoSaoleicustom_pluck_dbCustomPluckRecordidentifier_dbIdentifieruserms_dbUserMStournament_dbTournamentGSCTournamentWeeklyTournamentparticipant_dbTournamentParticipantGSCParticipantWeeklyParticipanttournament_user_dbTournamentUseruserprofile_dbUserProfileemail_otp_dbEmailVerifyRecordvideo_dbVideoModelExpandVideoModeltask_summary_cacheapi:common/tasksummarydisk_usage_cacheapi:common/diskusagevideo_summary_cacheapi:common/videosummarypluck_rank_cachecustomranking:pluck:{level}:rankzsetpluck_detail_cachecustomranking:pluck:{level}:detailhashnewest_cachenewest_queuehashfreeze_cachefreeze_queuehashreview_cachereview_queuehashnews_cachenews_queuezsetplayer_record_cacheplayer_{stat}_{mode}_{user_id}hashplayer_rank_cacheplayer_{stat}_{mode}_idszsettournament_cachetournament:normalhashsubclass + dataparticipant_cachetournament:normal:participantshashtournament_user_rank_cachetournament:user:{field}zsetmember = user_idcommon_summary_cacheapi:common/*TTL 300svideo_filesvideo filesavatar_filesavatar filescapture_video_updatecapture_video_updaterefresh_state_queue_on_video_saverefresh_state_queue_on_video_saveupdate_video_count_on_video_saveupdate_video_count_on_video_saveupdate_video_count_limit_on_video_saveupdate_video_count_limit_on_video_saveupdate_video_count_on_video_deleteupdate_video_count_on_video_deletecapture_previous_records_for_news_queuecapture_previous_records_for_news_queuepush_news_queue_on_record_savepush_news_queue_on_record_saverefresh_personal_record_on_video_saverefresh_personal_record_on_video_saverefresh_personal_record_on_video_deleterefresh_personal_record_on_video_deleterefresh_custom_pluck_rank_on_video_saverefresh_custom_pluck_rank_on_video_saveupdate_custom_pluck_cache_on_record_saveupdate_custom_pluck_cache_on_record_saveupdate_custom_pluck_cache_on_record_deleteupdate_custom_pluck_cache_on_record_deletecheckin_video_before_createcheckin_video_before_createadd_created_video_to_checked_tournamentsadd_created_video_to_checked_tournamentsupdate_cache_on_tournament_deleteupdate_cache_on_tournament_deleteupdate_cache_on_tournament_saveupdate_cache_on_tournament_saveupdate_cache_on_participant_saveupdate_cache_on_participant_saveupdate_best_score_on_gsc_participant_saveupdate_best_score_on_gsc_participant_saveupdate_best_score_on_weekly_participant_saveupdate_best_score_on_weekly_participant_saveupdate_best_score_on_gsc_participant_deleteupdate_best_score_on_gsc_participant_deleteupdate_best_score_on_weekly_participant_deleteupdate_best_score_on_weekly_participant_deleteremove_participant_cache_on_deleteremove_participant_cache_on_deletetask_saolei_video_import_bulktask_saolei_video_import_bulktask_saolei_video_importtask_saolei_video_importtask_gsc_finishtask_gsc_finishtask_gsc_refresh_besttask_gsc_refresh_besttask_award_tournamenttask_award_tournamenttask_weekly_finishtask_weekly_finishtask_weekly_refresh_besttask_weekly_refresh_best
cachecreate_account_link->accountlinkqueue_dbdelete_link->accountlinkqueue_dbdelete_link->accountlinkplatform_dbupdate_link->accountlinkplatform_dbview_saolei_import_one_video->task_dbview_saolei_import_one_video->videosaolei_dbview_saolei_import_one_video->video_dbview_saolei_import_one_video->video_filesview_saolei_import_videos->task_dbenqueue/deleteview_saolei_import_videos->accountlinkplatform_dbview_saolei_import_videos->task_saolei_video_import_bulkenqueuevideo_upload->video_dbvideo_upload->video_filesadd_identifier->custom_pluck_dbadd_identifier->identifier_dbadd_identifier->userms_dbdel_identifier->custom_pluck_dbdel_identifier->identifier_dbdel_identifier->userms_dbset_tournament->tournament_dbcancel_tournament->tournament_dbdelete_participant->participant_dbdelete (parent/subclass)create_gsc_participant->participant_dbregister_gsc_participant_identifier->identifier_dbregister_gsc_participant_identifier->userms_dbregister_gsc_participant_identifier->participant_dbregister_gsc_participant_identifier->video_dbcreate_weekly_participant->participant_dbupdate_user_profile->userprofile_dbupdate_user_avatar->userprofile_dbupdate_user_avatar->avatar_filesuser_retrieve->userprofile_dbuser_retrieve->email_otp_dbuser_register->userprofile_dbuser_register->email_otp_dbrefresh_captcha->captcha_dbget_email_captcha->captcha_dbcaptcha_db->user_logincaptcha_db->refresh_captchacaptcha_db->get_email_captchatask_db->view_saolei_import_one_videotask_db->view_saolei_import_videostask_db->view_saolei_get_import_listtask_db->view_saolei_get_import_summarytask_db->task_summary_cachetask_db->task_saolei_video_import_bulkread/deletetask_db->task_saolei_video_importstatus/readtask_db->task_gsc_finishstatus/readtask_db->task_gsc_refresh_beststatus/readtask_db->task_award_tournamentstatus/readtask_db->task_weekly_finishstatus/readtask_db->task_weekly_refresh_beststatus/readaccountlinkqueue_db->get_account_linksaccountlinkqueue_db->delete_linkaccountlinkplatform_db->get_account_linksaccountlinkplatform_db->update_linkaccountlinkplatform_db->view_saolei_import_one_videoaccountlinkplatform_db->view_saolei_import_videosaccountlinkplatform_db->view_saolei_get_import_listaccountlinkplatform_db->view_saolei_get_import_summaryaccountlinkplatform_db->task_saolei_video_import_bulkreadaccountlinkplatform_db->task_saolei_video_importFK readvideosaolei_db->view_saolei_import_one_videovideosaolei_db->view_saolei_import_videosvideosaolei_db->view_saolei_get_import_listvideosaolei_db->view_saolei_get_import_summaryvideosaolei_db->task_saolei_video_import_bulkread/writevideosaolei_db->task_saolei_video_importreadcustom_pluck_db->refresh_custom_pluck_rank_on_video_savereadcustom_pluck_db->update_custom_pluck_cache_on_record_savepost_savecustom_pluck_db->update_custom_pluck_cache_on_record_deletepost_deleteidentifier_db->get_participant_listidentifier_db->register_gsc_participant_identifieridentifier_db->update_cache_on_participant_saveFK readidentifier_db->task_saolei_video_importreaduserms_db->add_identifieruserms_db->del_identifieruserms_db->get_recordsuserms_db->get_records_abstractuserms_db->get_user_identifieruserms_db->update_user_profileuserms_db->update_user_avataruserms_db->user_loginuserms_db->user_retrieveuserms_db->user_registeruserms_db->update_video_count_on_video_saveO2O readuserms_db->update_video_count_limit_on_video_saveO2O readuserms_db->update_video_count_on_video_deleteO2O readuserms_db->capture_previous_records_for_news_queuepre_saveuserms_db->capture_previous_records_for_news_queuereaduserms_db->push_news_queue_on_record_savepost_saveuserms_db->refresh_personal_record_on_video_saveO2O readuserms_db->refresh_personal_record_on_video_deleteO2O readuserms_db->task_saolei_video_importO2O readtournament_db->get_tournament_listtournament_db->get_tournamenttournament_db->set_tournamenttournament_db->cancel_tournamenttournament_db->get_participant_listtournament_db->delete_participanthost_id read (join)tournament_db->get_participant_videostournament_db->download_all_videostournament_db->download_videos_participanttournament_db->get_gsc_resultstournament_db->create_gsc_participanttournament_db->register_gsc_participant_identifiertournament_db->get_weekly_resultstournament_db->create_weekly_participanttournament_db->update_video_count_on_video_deletem2m existstournament_db->checkin_video_before_createquery readtournament_db->update_cache_on_tournament_deletepost_deletetournament_db->update_cache_on_tournament_savepost_savetournament_db->update_cache_on_tournament_savesubclass readtournament_db->update_cache_on_participant_saveFK/m2m readtournament_db->update_best_score_on_gsc_participant_saveFK/subclass readtournament_db->update_best_score_on_weekly_participant_saveFK/subclass readtournament_db->update_best_score_on_gsc_participant_deleteFK/subclass readtournament_db->update_best_score_on_weekly_participant_deleteFK/subclass readtournament_db->task_gsc_finishread/writetournament_db->task_gsc_refresh_bestreadtournament_db->task_award_tournamentreadtournament_db->task_weekly_finishread/writetournament_db->task_weekly_refresh_bestreadparticipant_db->get_participant_listparticipant_db->delete_participantreadparticipant_db->get_participant_videosparticipant_db->get_gsc_resultsparticipant_db->register_gsc_participant_identifierparticipant_db->get_weekly_resultsparticipant_db->update_cache_on_participant_savepost_saveparticipant_db->update_best_score_on_gsc_participant_savepost_saveparticipant_db->update_best_score_on_weekly_participant_savepost_saveparticipant_db->update_best_score_on_gsc_participant_deletepost_deleteparticipant_db->update_best_score_on_gsc_participant_deletequery bestparticipant_db->update_best_score_on_weekly_participant_deletepost_deleteparticipant_db->update_best_score_on_weekly_participant_deletequery bestparticipant_db->remove_participant_cache_on_deletepost_deleteparticipant_db->task_gsc_finishread/write/deleteparticipant_db->task_gsc_refresh_bestreadparticipant_db->task_award_tournamentread/write rank_scoreparticipant_db->task_weekly_finishread/write/deleteparticipant_db->task_weekly_refresh_bestreadtournament_user_db->update_best_score_on_gsc_participant_saveread/createtournament_user_db->update_best_score_on_weekly_participant_saveread/createtournament_user_db->update_best_score_on_gsc_participant_deletereadtournament_user_db->update_best_score_on_weekly_participant_deletereadtournament_user_db->task_gsc_finishread/decaytournament_user_db->task_gsc_refresh_bestread/write besttournament_user_db->task_award_tournamentread/write scoretournament_user_db->task_weekly_finishread/decaytournament_user_db->task_weekly_refresh_bestread/write bestuserprofile_db->view_saolei_get_import_listuserprofile_db->set_tournamentuserprofile_db->cancel_tournamentuserprofile_db->get_participant_videosuserprofile_db->download_videos_participantuserprofile_db->get_gsc_resultsuserprofile_db->create_gsc_participantuserprofile_db->register_gsc_participant_identifieruserprofile_db->create_weekly_participantuserprofile_db->get_user_infouserprofile_db->get_user_info_bulkuserprofile_db->get_user_info_updateduserprofile_db->get_user_identifieruserprofile_db->get_user_avataruserprofile_db->get_user_videosuserprofile_db->update_user_profileuserprofile_db->update_user_avataruserprofile_db->user_loginuserprofile_db->user_retrieveuserprofile_db->user_registeruserprofile_db->check_collisionuserprofile_db->get_softwareuserprofile_db->video_previewuserprofile_db->video_downloaduserprofile_db->video_queryuserprofile_db->video_query_by_iduserprofile_db->refresh_state_queue_on_video_saveFK readuserprofile_db->update_video_count_on_video_saveFK readuserprofile_db->update_video_count_limit_on_video_saveFK readuserprofile_db->update_video_count_on_video_deleteFK readuserprofile_db->push_news_queue_on_record_savereverse O2O readuserprofile_db->refresh_personal_record_on_video_saveFK/query readuserprofile_db->refresh_personal_record_on_video_deleteFK readuserprofile_db->refresh_custom_pluck_rank_on_video_saveFK readuserprofile_db->task_saolei_video_importO2O reademail_otp_db->user_retrieveemail_otp_db->user_registervideo_db->view_saolei_import_one_videovideo_db->add_identifiervideo_db->del_identifiervideo_db->get_participant_videosvideo_db->download_all_videosvideo_db->download_videos_participantvideo_db->get_user_videosvideo_db->user_loginvideo_db->user_retrievevideo_db->user_registervideo_db->get_review_queuevideo_db->get_video_info_bulkvideo_db->get_video_detail_bulkvideo_db->get_softwarevideo_db->video_previewvideo_db->video_downloadvideo_db->video_queryvideo_db->video_query_by_idvideo_db->disk_usage_cachevideo_db->video_summary_cachevideo_db->capture_video_updatepre_savevideo_db->capture_video_updatereadvideo_db->refresh_state_queue_on_video_savepost_savevideo_db->refresh_state_queue_on_video_saveO2O readvideo_db->update_video_count_on_video_savepost_savevideo_db->update_video_count_limit_on_video_savepost_savevideo_db->update_video_count_on_video_deletepre_deletevideo_db->refresh_personal_record_on_video_savepost_savevideo_db->refresh_personal_record_on_video_saveread/refreshvideo_db->refresh_personal_record_on_video_deletepost_deletevideo_db->refresh_personal_record_on_video_deleteread bestvideo_db->refresh_custom_pluck_rank_on_video_savepost_savevideo_db->refresh_custom_pluck_rank_on_video_saveread bestvideo_db->update_custom_pluck_cache_on_record_saveFK readvideo_db->checkin_video_before_createpre_savevideo_db->checkin_video_before_createO2O readvideo_db->add_created_video_to_checked_tournamentspost_savevideo_db->update_cache_on_participant_savequery readvideo_db->task_saolei_video_importcollision/readvideo_db->task_gsc_finishread/writevideo_db->task_weekly_finishread/writetask_summary_cache->task_summarydisk_usage_cache->disk_usagevideo_summary_cache->video_summarypluck_rank_cache->pluck_rankpluck_rank_cache->player_pluck_recordspluck_detail_cache->pluck_rankpluck_detail_cache->player_pluck_recordsnewest_cache->newest_queuefreeze_cache->freeze_queuenews_cache->news_queuenews_cache->push_news_queue_on_record_saveread sizeplayer_record_cache->player_rankplayer_rank_cache->player_ranktournament_cache->get_tournament_listtournament_cache->get_tournament_newsparticipant_cache->checkin_video_before_createreadparticipant_cache->update_cache_on_tournament_deletescan/readparticipant_cache->update_cache_on_tournament_savescan/readparticipant_cache->update_cache_on_participant_savereadparticipant_cache->remove_participant_cache_on_deletereadvideo_files->view_saolei_import_one_videovideo_files->download_all_videosvideo_files->download_videos_participantvideo_files->video_previewvideo_files->video_downloadvideo_files->task_saolei_video_importreadavatar_files->get_user_avatarrefresh_state_queue_on_video_save->newest_cachewrite/deleterefresh_state_queue_on_video_save->freeze_cachewrite/deleterefresh_state_queue_on_video_save->review_cachewrite/deleteupdate_video_count_on_video_save->userms_dbwriteupdate_video_count_limit_on_video_save->userms_dbwriteupdate_video_count_on_video_delete->userms_dbwritepush_news_queue_on_record_save->news_cachewrite/trimrefresh_personal_record_on_video_save->userms_dbwriterefresh_personal_record_on_video_save->player_record_cachewriterefresh_personal_record_on_video_save->player_rank_cachewriterefresh_personal_record_on_video_delete->userms_dbwriterefresh_personal_record_on_video_delete->player_record_cachewriterefresh_personal_record_on_video_delete->player_rank_cachewriterefresh_custom_pluck_rank_on_video_save->custom_pluck_dbwrite/deleteupdate_custom_pluck_cache_on_record_save->pluck_rank_cachewriteupdate_custom_pluck_cache_on_record_save->pluck_detail_cachewriteupdate_custom_pluck_cache_on_record_delete->pluck_rank_cachedeleteupdate_custom_pluck_cache_on_record_delete->pluck_detail_cachedeletecheckin_video_before_create->video_dbwrite fieldadd_created_video_to_checked_tournaments->tournament_dbm2m writeupdate_cache_on_tournament_delete->tournament_cachedeleteupdate_cache_on_tournament_delete->participant_cachewrite/deleteupdate_cache_on_tournament_save->tournament_cachewrite/deleteupdate_cache_on_tournament_save->participant_cachewrite/deleteupdate_cache_on_participant_save->tournament_dbm2m writeupdate_cache_on_participant_save->participant_cachewrite/deleteupdate_best_score_on_gsc_participant_save->tournament_user_dbwrite bestupdate_best_score_on_weekly_participant_save->tournament_user_dbwrite bestupdate_best_score_on_gsc_participant_delete->tournament_user_dbwrite bestupdate_best_score_on_weekly_participant_delete->tournament_user_dbwrite bestremove_participant_cache_on_delete->participant_cachewrite/deletetask_saolei_video_import_bulk->task_dbenqueue/deletetask_saolei_video_import_bulk->videosaolei_dbwritetask_saolei_video_import_bulk->task_saolei_video_importenqueue eachtask_saolei_video_import->task_dbstatus writetask_saolei_video_import->videosaolei_dbwritetask_saolei_video_import->userms_dbcreatetask_saolei_video_import->video_dbwritetask_saolei_video_import->video_fileswritetask_gsc_finish->tournament_dbstate writetask_gsc_finish->participant_dbscore/rank/awardtask_gsc_finish->tournament_user_dbaward/decaytask_gsc_finish->pluck_rank_cacherestore plucktask_gsc_finish->pluck_detail_cacherestore plucktask_gsc_finish->newest_cacherestore queuestask_gsc_finish->freeze_cacherestore queuestask_gsc_finish->review_cacherestore queuestask_gsc_finish->player_record_cacherestore recordstask_gsc_finish->player_rank_cacherestore recordstask_gsc_finish->task_gsc_refresh_bestenqueuetask_gsc_finish->task_award_tournamentenqueuetask_gsc_refresh_best->tournament_user_rank_cachewrite best zsettask_award_tournament->tournament_user_rank_cachewrite score zsetstask_weekly_finish->tournament_dbstate writetask_weekly_finish->participant_dbscore/rank/awardtask_weekly_finish->tournament_user_dbaward/decaytask_weekly_finish->pluck_rank_cacherestore plucktask_weekly_finish->pluck_detail_cacherestore plucktask_weekly_finish->newest_cacherestore queuestask_weekly_finish->freeze_cacherestore queuestask_weekly_finish->review_cacherestore queuestask_weekly_finish->player_record_cacherestore recordstask_weekly_finish->player_rank_cacherestore recordstask_weekly_finish->task_award_tournamentenqueuetask_weekly_finish->task_weekly_refresh_bestenqueuetask_weekly_refresh_best->tournament_user_rank_cachewrite best zsetget_account_links/api/accountlink/{user_id}create_account_link/api/accountlink/create/delete_link/accountlink/delete/update_link/accountlink/update/view_saolei_import_one_video/accountlink/saolei_import_video/view_saolei_import_videos/accountlink/saolei_import_videos/view_saolei_get_import_list/accountlink/saolei/videolist/get/view_saolei_get_import_summary/accountlink/saolei/videoimport/stat/task_summary/api/common/tasksummarydisk_usage/api/common/diskusagevideo_summary/api/common/videosummaryvideo_upload/common/uploadvideo/pluck_rank/api/customranking/pluckplayer_pluck_records/api/customranking/pluck/playeradd_identifier/identifier/add/del_identifier/identifier/del/get_records/api/msuser/recordsget_records_abstract/api/msuser/records_abstractplayer_rank/msuser/player_rank/get_tournament_list/api/tournament/get_listget_tournament/api/tournament/getset_tournament/api/tournament/setcancel_tournament/api/tournament/cancelget_participant_list/api/tournament/participantsdelete_participantDELETE /api/tournament/participant/{participant_id}get_participant_videos/api/tournament/get_videos/participantget_tournament_news/api/tournament/get_newsdownload_all_videos/api/tournament/downloaddownload_videos_participant/api/tournament/download/participantget_gsc_results/api/tournament/gsc/resultscreate_gsc_participant/api/tournament/gsc/participantregister_gsc_participant_identifier/api/tournament/gsc/participant/identifierget_weekly_results/api/tournament/weekly/resultscreate_weekly_participant/api/tournament/weekly/participantget_user_info/api/userprofile/info/{user_id}get_user_info_bulk/api/userprofile/infobulkget_user_info_updated/api/userprofile/infoupdatedget_user_identifier/api/userprofile/identifierget_user_avatar/api/userprofile/avatar/{user_id}get_user_videos/api/userprofile/videolistupdate_user_profile/api/userprofile/update_profileupdate_user_avatar/api/userprofile/update_avataruser_login/userprofile/login/user_retrieve/userprofile/retrieve/user_register/userprofile/register/check_collision/userprofile/checkcollision/refresh_captcha/userprofile/refresh_captcha/get_email_captcha/userprofile/get_email_captcha/get_review_queue/api/video/review_queueget_video_info_bulk/api/video/infobulkget_video_detail_bulk/api/video/detailbulkget_software/video/get_software/video_preview/video/preview/video_download/video/download/video_query/video/query/video_query_by_id/video/query_by_id/newest_queue/video/newest_queue/news_queue/video/news_queue/freeze_queue/video/freeze_queue/captcha_dbCaptchaStoretask_dbDBTaskResultaccountlinkqueue_dbAccountLinkQueueplatform accountsaccountlinkplatform_dbAccountSaoleiAccountMinesweeperGamesAccountBilibiliAccountWorldOfMinesweeperAccountQQvideosaolei_dbVideoSaoleicustom_pluck_dbCustomPluckRecordidentifier_dbIdentifieruserms_dbUserMStournament_dbTournamentGSCTournamentWeeklyTournamentparticipant_dbTournamentParticipantGSCParticipantWeeklyParticipanttournament_user_dbTournamentUseruserprofile_dbUserProfileemail_otp_dbEmailVerifyRecordvideo_dbVideoModelExpandVideoModeltask_summary_cacheapi:common/tasksummarydisk_usage_cacheapi:common/diskusagevideo_summary_cacheapi:common/videosummarypluck_rank_cachecustomranking:pluck:{level}:rankzsetpluck_detail_cachecustomranking:pluck:{level}:detailhashnewest_cachenewest_queuehashfreeze_cachefreeze_queuehashreview_cachereview_queuehashnews_cachenews_queuezsetplayer_record_cacheplayer_{stat}_{mode}_{user_id}hashplayer_rank_cacheplayer_{stat}_{mode}_idszsettournament_cachetournament:normalhashsubclass + dataparticipant_cachetournament:normal:participantshashtournament_user_rank_cachetournament:user:{field}zsetmember = user_idcommon_summary_cacheapi:common/*TTL 300svideo_filesvideo filesavatar_filesavatar filescapture_video_updatecapture_video_updaterefresh_state_queue_on_video_saverefresh_state_queue_on_video_saveupdate_video_count_on_video_saveupdate_video_count_on_video_saveupdate_video_count_limit_on_video_saveupdate_video_count_limit_on_video_saveupdate_video_count_on_video_deleteupdate_video_count_on_video_deletecapture_previous_records_for_news_queuecapture_previous_records_for_news_queuepush_news_queue_on_record_savepush_news_queue_on_record_saverefresh_personal_record_on_video_saverefresh_personal_record_on_video_saverefresh_personal_record_on_video_deleterefresh_personal_record_on_video_deleterefresh_custom_pluck_rank_on_video_saverefresh_custom_pluck_rank_on_video_saveupdate_custom_pluck_cache_on_record_saveupdate_custom_pluck_cache_on_record_saveupdate_custom_pluck_cache_on_record_deleteupdate_custom_pluck_cache_on_record_deletecheckin_video_before_createcheckin_video_before_createadd_created_video_to_checked_tournamentsadd_created_video_to_checked_tournamentsupdate_cache_on_tournament_deleteupdate_cache_on_tournament_deleteupdate_cache_on_tournament_saveupdate_cache_on_tournament_saveupdate_cache_on_participant_saveupdate_cache_on_participant_saveupdate_best_score_on_gsc_participant_saveupdate_best_score_on_gsc_participant_saveupdate_best_score_on_weekly_participant_saveupdate_best_score_on_weekly_participant_saveupdate_best_score_on_gsc_participant_deleteupdate_best_score_on_gsc_participant_deleteupdate_best_score_on_weekly_participant_deleteupdate_best_score_on_weekly_participant_deleteremove_participant_cache_on_deleteremove_participant_cache_on_deletetask_saolei_video_import_bulktask_saolei_video_import_bulktask_saolei_video_importtask_saolei_video_importtask_gsc_finishtask_gsc_finishtask_gsc_refresh_besttask_gsc_refresh_besttask_award_tournamenttask_award_tournamenttask_weekly_finishtask_weekly_finishtask_weekly_refresh_besttask_weekly_refresh_best

缓存数据结构 ​

所属 appkeyRedis 类型数据结构
videomanagernewest_queuehashfield = video_id;value = VideoQueue JSON,包含 state、tournament、software、time、player_id、identifier、level、mode、timems、bv、cl、ce。
videomanagerfreeze_queuehash同 newest_queue,用于冻结录像队列。
videomanagerreview_queuehash同 newest_queue,用于待审核录像队列。
msuser / videomanagernews_queuezsetmember = news JSON;score = time.timestamp();最多保留 200 条。JSON 包含 time、player_id、video_id、index、mode、level、value、old_value。
msuserplayer_{stat}_{mode}_{user_id}hash三关个人纪录详情。字段为 b、i、e、b_id、i_id、e_id、sum。
msuserplayer_{stat}_{mode}_idszsetmember = user_id;score = 三关 sum。player_rank 使用它作为排序入口,并通过 Redis SORT GET 读取详情 hash。
customrankingcustomranking:pluck:{level}:rankzsetmember = player_id;score = pluck,当 pluck == 0 时使用 timems - MAX_TIMEMS 降低 0 碰撞风险。
customrankingcustomranking:pluck:{level}:detailhashfield = player_id;value = detail JSON,包含 video_id、mode、timems、bv、upload_time。
tournamenttournament:normalhashfield = tournament_id;value = CachedTournament JSON,包含 id、state、subclass、host_id、start_time、end_time、data。data 保存子类独占字段:GSC 为 order、token;周赛为 year、week、tournament_format。
tournamenttournament:normal:participantshashfield = user_id;value = list[CachedNormalParticipant] JSON,每项包含 id、token、arbiter_identifier、tournament、start_time、end_time。
tournamenttournament:user:score_current / score_total / gsc_total / gsc_best / weekly_total / weekly_classic_total / weekly_classic_bestzsetmember = user_id;score = TournamentUser 对应字段值。score_current、各 total 字段为 0 时不写入;gsc_best、weekly_classic_best 为 MAX_TOURNAMENT_BEST 时不写入。
commonapi:common/videosummaryDjango cachevideo_summary 返回体,TTL 300 秒。
commonapi:common/tasksummaryDjango cachetask_summary 返回体,TTL 300 秒。
commonapi:common/diskusageDjango cachedisk_usage 返回体,TTL 300 秒。
articlearticleslist文章目录项字符串,来自 assets/article 或静态目录下的文章文件。

TournamentUser 是比赛积分的持久化汇总表;Redis 中另用 7 个 sorted set 保存排行榜入口。站内用户创建 TournamentParticipant / GSCParticipant / WeeklyParticipant 时,保存信号会在当前数据库事务内立即创建缺失的 TournamentUser;删除 participant 不会跟随删除 TournamentUser。无站内用户的 participant 在数据库中保留 user_id = NULL,但 API 序列化时统一输出 user_id = 0,前端只按 0 识别非站内用户。GSC / 周赛 finish 任务会先调用 delete_participants_without_videos 删除无录像站内 participant。排名积分发放和 best 刷新是独立的非关键后台任务,会各自从本场剩余站内 participant 出发,通过 participant.user.tournamentuser 取得对应的 TournamentUser,并使用 select_related('user__tournamentuser') 避免 N+1。积分发放任务读取并衰减既有 TournamentUser.score_current,再根据本场 participant 的 rank_score 增量写回 TournamentUser 和 TournamentParticipant.rank_score,随后同步刷新 score_current、score_total 和对应分类 total 的 zset。历史最好成绩在 participant 保存后只读取当前 participant 和对应比赛子表,并与 TournamentUser.gsc_best / weekly_classic_best 直接比较;只有当前成绩更好时才改变内存值。结算流程使用 bulk_update 写入 rank_score,不会触发保存信号,因此 best 刷新通过 refresh_gsc_best_scores / refresh_weekly_best_scores 作为独立后台任务执行,并在写库后刷新对应 best zset;best 与排名积分发放没有顺序依赖。为了简化结算代码,积分发放和 best 刷新都不筛选字段是否发生变化,会统一 bulk_update 候选 participant 和对应 TournamentUser。结算链路通过 tournament logger 写入 logs/tournament.log,记录后台任务、删除无录像 participant、读取 TournamentUser、成绩/排名刷新、积分发放、best 刷新、状态切换和录像公开等阶段的处理数量。没有有效历史成绩时,best 字段使用 MAX_TOURNAMENT_BEST 作为哨兵值,并且不写入 Redis。participant 删除时,GSC / 周赛各自的信号会在当前事务内按需调用 calculate_gsc_best_score / calculate_weekly_classic_best 重算该类型历史最好成绩,并同步更新对应 best zset。由于 TournamentUser 是数据库汇总数据,participant 信号触发的创建和 best 更新必须在当前事务内立即执行,不使用 transaction.on_commit。如果需要修复历史汇总数据,尤其是把旧的 0 best 值迁移到新的最大值哨兵,可以运行 manage.py refresh_tournament_user_stats。该命令会先调用 tournament.services.refresh_tournament_user_total_fields 重建 score_total、gsc_total、weekly_total 和 weekly_classic_total,再执行命令内的 best 重建步骤写回 gsc_best 和 weekly_classic_best;score_current 依赖实时衰减,不由该命令刷新。如果 Redis 排行缓存丢失或需要按当前数据库状态重建,可以运行 manage.py rebuild_tournament_user_cache。

GSCParticipant.t37 是数据库持久化 generated field,并建立 gsc_t37_idx 索引,服务于 GSC 排名和历史最好成绩查询。保存信号使用当前 participant 实例上的临时 t37 值进行 best 增量比较,因此不会为了读取 generated field 再查询一次 participant。

写入与重建入口 ​

缓存主要写入入口重建 / 清理入口
录像状态队列videomanager.signals.refresh_state_queue_on_video_savevideomanager.cache.add_videos_to_state_queues_bulk 可按状态批量恢复普通队列。
纪录新闻msuser.signals.push_news_queue_on_record_savevideomanager.management.commands.refresh_stnb 会清理 news_queue。
经典三关排行UserMS.update_3_level_cache_recordUserMS.del_user_record_redis 删除单个用户所有排行缓存;个人纪录重建后会重新写入。
自定义 pluck 排行customranking.services.update_custom_pluck_top_cachemanage.py rebuild_custom_pluck_cache 从 CustomPluckRecord 全量重建。
NORMAL 比赛TournamentCache.update_tournamentmanage.py rebuild_tournament_cache 显式查询 NORMAL GSC 与周赛并重建。
NORMAL 参赛关系TournamentCache.update_participant / remove_participantmanage.py rebuild_tournament_cache 按 user_id 分组重建。
比赛积分排行TournamentCache.update_tournament_user / update_tournament_usersmanage.py rebuild_tournament_user_cache 从 TournamentUser 全量重建 7 个 zset。
common 摘要对应 API 内部 cache.setTTL 到期自动失效。
文章目录article.views.update_list管理员手动调用 update_list 全量刷新。

读取约定 ​

  • NORMAL 比赛列表只读 tournament:normal,不在缓存未命中时回落数据库;缓存与数据库不同步视为写路径 bug。
  • 录像队列缓存不保存比赛录像,VideoQueueCache.add / add_bulk 会跳过 ongoing_tournament=True 的录像。
  • 参赛 checkin 先读 tournament:normal:participants,命中后再按 tournament id 查询数据库对象,用于写入录像的多对多关系。
  • customranking:pluck:{level}:rank 只保存排序所需数据,展示字段来自同级 detail hash。
  • player_rank 的请求参数直接指定 Redis 排行 key 和详情 key;调用方必须保证 key 与 UserMS.update_3_level_cache_record 写入规则一致。