Closed MahnoorShafique closed 11 months ago
All cacheops calls are either get cache, set cache or cache invalidation, which happens upon save/delete signals.
You can:
@Suor This is my viewset Class:
class BookViewSet(ModelViewSet):
permission_classes = [IsAuthenticated | RetoolIPPermission | HasAPIKey]
queryset = Book.objects.select_related("grade_subject").all()
serializer_class = BookSerializer
http_method_names = ["get"]
filter_backends = [DjangoFilterBackend]
filterset_class = BookFilter
below are models
class Book(TimeStampedModel):
grade_subject = ForeignKey(GradeSubject, on_delete=SET_NULL, null=True)
...
other fields
....
class GradeSubject(TimeStampedModel):
grade = ForeignKey(Grade, on_delete=SET_NULL, null=True)
subject = ForeignKey(Subject, on_delete=SET_NULL, null=True)
as you can see in image it calls db 1 time but calls redis 1960 times. I have implemented caching using django-cacheops. what's missing , I am unable to debug. Can you please guide?
All the advices stay the same, not sure what can I add to that. For now one cannot even say where these redis queries are coming from.
I am inheriting my classes in views from ModelViewSet . and using builtin for queryset and serializer class upon configuring django-cacheops I saw so many calls to ElastiCache in ELK server for a single transaction. What is the reason for this?