NDOJ/judge/caching.py

11 lines
378 B
Python
Raw Permalink Normal View History

2020-01-21 06:35:58 +00:00
from django.core.cache import cache
def finished_submission(sub):
2022-05-14 17:57:27 +00:00
keys = ["user_complete:%d" % sub.user_id, "user_attempted:%s" % sub.user_id]
if hasattr(sub, "contest"):
2020-01-21 06:35:58 +00:00
participation = sub.contest.participation
2022-05-14 17:57:27 +00:00
keys += ["contest_complete:%d" % participation.id]
keys += ["contest_attempted:%d" % participation.id]
2020-01-21 06:35:58 +00:00
cache.delete_many(keys)