code: def process_request(self, request):
          
          if self.cache_anonymous_only:
              assert hasattr(request, 'user'), "The Django cache middleware with CACHE_MIDDLEWARE_ANONYMOUS_ONLY=True requires authentication middleware to be installed. Edit your MIDDLEWARE_CLASSES setting to insert 'django.contrib.auth.middleware.AuthenticationMiddleware' before the CacheMiddleware."
  
          if not request.method in ('GET', 'HEAD') or request.GET:
              request._cache_update_cache = False
              return None # Don't bother checking the cache.
  
          if self.cache_anonymous_only and request.user.is_authenticated():
              request._cache_update_cache = False
              return None # Don't cache requests from authenticated users.
  
          cache_key = get_cache_key(request, self.key_prefix)
          request._cache_middleware_key = cache_key
  
          if cache_key is None:
              request._cache_update_cache = True
              return None # No cache information available, need to rebuild.
  
          response = cache.get(cache_key, None)
          if response is None:
              request._cache_update_cache = True
              return None # No cache information available, need to rebuild.
  
          orig_time, response = response
          # time to refresh the cache
          if orig_time and  ((time.time() - orig_time) > self.cache_refresh_timeout):
              request._cache_update_cache = True
              # keep the response in the cache for just self.timeout seconds and mark it for update
              # other requests will continue werving this response from cache while I alone work on refreshing it
              cache.set(cache_key, (None, response), self.timeout)
              return None
  
          request._cache_update_cache = False
          return response
docs: Checks whether the page is already cached and returns the cached
          version if available.