Closed mapleflow closed 6 years ago
def calculate_cache_key(view_instance, view_method,
request, args, kwargs):
# i want cache only in home page request
# but now it cache in 'None' key
# you can see something in 'None' key
if request.page_url == 'home_page':
return 'home_page'
class CityView(views.APIView):
@cache_response(60 * 15, key_func=calculate_cache_key)
def get(self, request, *args, **kwargs):
pass
if not response.status_code >= 400 or self.cache_errors:
# not the key is 'None'
self.cache.set(key, response, self.timeout)
i was talking about providing unit and integration test
None will not cache. Is it right ?