

def process_request(self, request):
    '\n        Checks whether the page is already cached and returns the cached\n        version if available.\n        '
    if (request.method not in ('GET', 'HEAD')):
        request._cache_update_cache = False
        return None
    cache_key = get_cache_key(request, self.key_prefix, 'GET', cache=self.cache)
    if (cache_key is None):
        request._cache_update_cache = True
        return None
    response = self.cache.get(cache_key)
    if ((response is None) and (request.method == 'HEAD')):
        cache_key = get_cache_key(request, self.key_prefix, 'HEAD', cache=self.cache)
        response = self.cache.get(cache_key)
    if (response is None):
        request._cache_update_cache = True
        return None
    request._cache_update_cache = False
    return response

dataset/ETHPy150Open django/django/django/middleware/cache.py FetchFromCacheMiddleware.process_request/original