code: def cache_add(self, request, response):
          
          logger.debug("adding response to the cache")
  
          """
          checking for valid code
  -       """
          code = response.code
          try:
              utils.check_code(code)
          except utils.InvalidResponseCode:  # pragma no cover
              logger.error("Invalid response code")
              return
  
          """
          return if max_age is 0
          """
          if response.max_age == 0:
              return
  
          """
          Initialising new cache element based on the mode and updating the cache
          """
  
          if self.mode == defines.FORWARD_PROXY:
              new_key = CacheKey(request)
          else:
              new_key = ReverseCacheKey(request)
  
          logger.debug("MaxAge = {maxage}".format(maxage=response.max_age))
          new_element = CacheElement(new_key, response, request, response.max_age)
  
          self.cache.update(new_key, new_element)
          logger.debug("Cache Size = {size}".format(size=self.cache.debug_print()))
docs: checks for full cache and valid code before updating the cache
  
          :param request:
          :param response:
          :return: