def _read_cache(self):
     """
     Overrides parent method to use CachedResponse instead of memcache
     """
     response = CachedResponse.get_by_id(self.cache_key)
     if response:
         self._last_modified = response.updated
         return response
     else:
         return None
Ejemplo n.º 2
0
 def _write_cache(self, response):
     """
     Overrides parent method to use CachedResponse instead of memcache
     """
     if tba_config.CONFIG["response_cache"]:
         CachedResponse(
             id=self.cache_key,
             headers_json=json.dumps(dict(response.headers)),
             body=response.body,
         ).put()
Ejemplo n.º 3
0
 def _read_cache(self):
     """
     Overrides parent method to use CachedResponse instead of memcache
     """
     response = CachedResponse.get_by_id(self.cache_key)
     if response:
         self._last_modified = response.updated
         return response
     else:
         return None
 def _read_cache(self):
     """
     Overrides parent method to use CachedResponse instead of memcache
     Returns:
     None if not cached
     the cached response if cached
     True if in not modified
     """
     response = CachedResponse.get_by_id(self.cache_key)
     if response:
         if self._has_been_modified_since(response.updated):
             response.headers['Last-Modified'] = self.response.headers['Last-Modified']
             return response
         else:
             return True
     else:
         return None
 def _read_cache(self):
     """
     Overrides parent method to use CachedResponse instead of memcache
     Returns:
     None if not cached
     the cached response if cached
     True if in not modified
     """
     response = CachedResponse.get_by_id(self.cache_key)
     if response:
         if self._has_been_modified_since(response.updated):
             response.headers['Last-Modified'] = self.response.headers[
                 'Last-Modified']
             return response
         else:
             return True
     else:
         return None