I have followed the solution provided in Stack overflow Link & it is working perfectly when i use this from my browser. However, when i tried hitting that url with curl, it doesn't cache for the browser..
Let me explain.
If i hit a url like
example.org/results?limit=7from my chrome, it takes8-10 secondsto load & successive hits takes time inmilliseconds
So what i did is call this URL with the curl command; but it didn't use the cached data & created the cache again.
So i found out the issue is with the arg parameter in the below code as it contains the browser headers in WSGIRequest object which is being used in caching key as it contains the headers also which i don't require for caching. This is failing my purpose of curl requests to create the cache automatically from celery task.
@method_decorator(cache_page(60 * 60 * 24))
def dispatch(self, *arg, **kwargs):
print(arg)
print(kwargs)
return super(ProfileLikeHistoryApi, self).dispatch(*arg, **kwargs)
What can i do is to pass only the kwargs to create the cache or any other alternative by which i can do cache for urls only not the headers
Thanks for the help in advance.