diff --git a/backend/dining/views.py b/backend/dining/views.py index c3d5db46..3db05212 100644 --- a/backend/dining/views.py +++ b/backend/dining/views.py @@ -13,6 +13,7 @@ from dining.api_wrapper import APIError, DiningAPIWrapper from dining.models import DiningMenu, Venue from dining.serializers import DiningMenuSerializer +from utils.cache import Cache d = DiningAPIWrapper() @@ -67,6 +68,7 @@ def get(self, request): preferences = request.user.profile.dining_preferences # aggregates venues and puts it in form {"venue_id": x, "count": x} cached_preferences = preferences.values("venue_id").annotate(count=Count("venue_id")) + cache.set(key, cached_preferences, Cache.MONTH) return Response({"preferences": cached_preferences}) def post(self, request):