Skip to content

Commit

Permalink
feat: caching of some dining routes
Browse files Browse the repository at this point in the history
  • Loading branch information
tuneerroy committed Sep 15, 2023
1 parent 85881fa commit 5f85b27
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions backend/dining/urls.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,29 @@
from django.urls import path
from django.views.decorators.cache import cache_page
from backend.utils.cache import HOUR_IN_SECONDS, MONTH_IN_SECONDS_APPROX

from dining.views import Menus, Preferences, Venues


urlpatterns = [
path(
"venues/",
cache_page(30 * 24 * 60 * 60)(Venues),
cache_page(1 * MONTH_IN_SECONDS_APPROX)(Venues),
name="venues",
),
path("menus/", Menus.as_view(), name="menus"),
path("menus/<date>/", Menus.as_view(), name="menus-with-date"),
path("preferences/", Preferences.as_view(), name="dining-preferences"),
path(
"menus/",
cache_page(1 * HOUR_IN_SECONDS)(Menus),
name="menus",
),
path(
"menus/<date>/",
cache_page(1 * HOUR_IN_SECONDS)(Menus),
name="menus-with-date",
),
path(
"preferences/",
Preferences.as_view(),
name="dining-preferences",
),
]

0 comments on commit 5f85b27

Please sign in to comment.