mirror of
https://github.com/lemeow125/StudE-Backend.git
synced 2025-06-29 00:35:45 +08:00
Fixed issue of not connecting to redis instance and added caching for courses
This commit is contained in:
parent
7053f1d487
commit
0215680ea5
4 changed files with 26 additions and 2 deletions
|
@ -1,3 +1,5 @@
|
|||
from django.utils.decorators import method_decorator
|
||||
from django.views.decorators.cache import cache_page
|
||||
from rest_framework import generics
|
||||
from .models import Course
|
||||
from .serializers import CourseSerializer
|
||||
|
@ -6,3 +8,7 @@ from .serializers import CourseSerializer
|
|||
class CourseListView(generics.ListAPIView):
|
||||
serializer_class = CourseSerializer
|
||||
queryset = Course.objects.all()
|
||||
|
||||
@method_decorator(cache_page(60*60))
|
||||
def dispatch(self, *args, **kwargs):
|
||||
return super().dispatch(*args, **kwargs)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue