I'm using redis server for caching. Using django-redis package.
Below is my setting file :
CACHES = {
'default': {
'BACKEND': 'django_redis.cache.RedisCache',
'LOCATION': 'redis://127.0.0.1:6379/1',
'OPTIONS': {
'CLIENT_CLASS': 'django_redis.client.DefaultClient',
},
}
}
My view :
from django.utils.decorators import method_decorator
from django.views.decorators.cache import cache_page
@method_decorator(cache_page(timeout=None,key_prefix="site1"), name='dispatch')
class ProfileView(APIView):
# With auth: cache requested url for each user for 2 hours
def get(self, request, format=None):
content = {
'user_feed': request.user.get_user_feed()
}
return Response(content)
When set timeout=60 it's working. But when i add timeout=None i'm getting 600 seconds timeout.