-
Notifications
You must be signed in to change notification settings - Fork 531
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cache contributors views #3091
Cache contributors views #3091
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,9 @@ | ||
from django.urls import include, path | ||
from django.views.decorators.cache import cache_page | ||
from django.views.generic import RedirectView | ||
|
||
from pontoon.settings import PER_VIEW_CACHE_TIMEOUT | ||
|
||
from . import views | ||
|
||
|
||
|
@@ -70,7 +73,9 @@ | |
# Team contributors | ||
path( | ||
"contributors/", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As per the docs, if multiple URLs point at the same view, each URL will be cached separately. In this example, |
||
views.LocaleContributorsView.as_view(), | ||
cache_page(PER_VIEW_CACHE_TIMEOUT)( | ||
views.LocaleContributorsView.as_view() | ||
), | ||
name="pontoon.teams.ajax.contributors", | ||
), | ||
# Team insights | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Django docs recommend to specify the per-view cache in the URLconf rather than next to the view functions themselves.