Add type check for cache

This commit is contained in:
cuom1999 2024-05-08 10:15:55 -05:00
parent f1ba0e79c1
commit 0ea822f7a0
10 changed files with 35 additions and 13 deletions

View file

@ -7,6 +7,8 @@ from django.contrib.sites.shortcuts import get_current_site
from django.core.cache import cache
from django.utils.functional import SimpleLazyObject, new_method_proxy
from mptt.querysets import TreeQuerySet
from .models import MiscConfig, NavigationBar, Profile
from judge.caching import cache_wrapper
@ -52,7 +54,7 @@ def comet_location(request):
return {"EVENT_DAEMON_LOCATION": websocket, "EVENT_DAEMON_POLL_LOCATION": poll}
@cache_wrapper(prefix="nb")
@cache_wrapper(prefix="nb", expected_type=TreeQuerySet)
def _nav_bar():
return NavigationBar.objects.all()