0

I am trying to integrate caching with the Django rest framework. I came across cache_page module from django.views.decorators.cache. Can someone please tell me how can I can see the data stored in this method.

Reference link here

Dulaj Kulathunga
  • 1,248
  • 2
  • 9
  • 19
akhil
  • 1
  • 1

1 Answers1

0

Django can be setup with different cache storage options, for example memchached or using your database. Depending on your cache storage selection, you can check that storage for the cached data.

For example, if you were to use a database, you would create a table and add the following to settings.py:

CACHES = {
    'default': {
        'BACKEND': 'django.core.cache.backends.db.DatabaseCache',
        'LOCATION': 'my_cache_table',
    }
}

See Django cache docs for how to setup cache

For a Django Rest Framework implementation:

  1. APIView and ViewSet see the docs:
  2. caching querysets (ListAPIView), this has already been addressed here: How to cache Django Rest Framework API calls?
Dulaj Kulathunga
  • 1,248
  • 2
  • 9
  • 19
Avi Kaminetzky
  • 1,489
  • 2
  • 19
  • 42