def build_response(<EOL>self, request, response, from_cache=False, cacheable_methods=None<EOL>):
cacheable = cacheable_methods or self.cacheable_methods<EOL>if not from_cache and request.method in cacheable:<EOL><INDENT>if self.heuristic:<EOL><INDENT>response = self.heuristic.apply(response)<EOL><DEDENT>if response.status == <NUM_LIT>:<EOL><INDENT>cached_response = self.controller.update_cached_response(<EOL>request, response<EOL>)<EOL>if cached_response is not response:<EOL><INDENT>from_cache = True<EOL><DEDENT>response.read(decode_content=False)<EOL>response.release_conn()<EOL>response = cached_response<EOL><DEDENT>elif response.status == <NUM_LIT>:<EOL><INDENT>self.controller.cache_response(request, response)<EOL><DEDENT>else:<EOL><INDENT>response._fp = CallbackFileWrapper(<EOL>response._fp,<EOL>functools.partial(<EOL>self.controller.cache_response, request, response<EOL>),<EOL>)<EOL>if response.chunked:<EOL><INDENT>super_update_chunk_length = response._update_chunk_length<EOL>def _update_chunk_length(self):<EOL><INDENT>super_update_chunk_length()<EOL>if self.chunk_left == <NUM_LIT:0>:<EOL><INDENT>self._fp._close()<EOL><DEDENT><DEDENT>response._update_chunk_length = types.MethodType(<EOL>_update_chunk_length, response<EOL>)<EOL><DEDENT><DEDENT><DEDENT>resp = super(CacheControlAdapter, self).build_response(request, response)<EOL>if request.method in self.invalidating_methods and resp.ok:<EOL><INDENT>cache_url = self.controller.cache_url(request.url)<EOL>self.cache.delete(cache_url)<EOL><DEDENT>resp.from_cache = from_cache<EOL>return resp<EOL>
Build a response by making a request or using the cache.

This will end up calling send and returning a potentially
cached response