Checks whether the page is already cached and returns the cached
        version if available.

def process_request(self, request):
        """
        Checks whether the page is already cached and returns the cached
        version if available.
        """

        celery_task = getattr(request, '_cache_update_cache', False)
        if not request.method in ('GET', 'HEAD'):
            request._cache_update_cache = False
            return None # Don't bother checking the cache.

        request._cache_update_cache = True
        if self.should_bypass_cache(request):
            return None

        response, expired = self.get_cache(request)

        if response is None:
            return None # No cache information available, need to rebuild.

        # TODO: this logic should be in the task not here but it needs the per_request_middleware
        if celery_task:
            if self.should_regenerate(response):
                return None
        elif expired:
            self.send_task(request, response)
        # don't update right since we're serving from cache
        request._cache_update_cache = False

        return response