'Sets the cache, if needed.'

def process_response(self, request, response):

    if (not self._should_update_cache(request, response)):
        return response
    if (response.streaming or (response.status_code != 200)):
        return response
    if ((not request.COOKIES) and response.cookies and has_vary_header(response, 'Cookie')):
        return response
    timeout = get_max_age(response)
    if (timeout == None):
        timeout = self.cache_timeout
    elif (timeout == 0):
        return response
    patch_response_headers(response, timeout)
    if timeout:
        cache_key = learn_cache_key(request, response, timeout, self.key_prefix, cache=self.cache)
        if (hasattr(response, 'render') and callable(response.render)):
            response.add_post_render_callback((lambda r: self.cache.set(cache_key, r, timeout)))
        else:
            self.cache.set(cache_key, response, timeout)
    return response
