Set cache entry for key with contents of response.

def set(self, key, response):
        """Set cache entry for key with contents of response."""
        mod = response.headers.pop('last-modified', None)
        status = int(response.status_code)
        rec = (key, status, mod, response.encoding, response.content,
               json.dumps(dict(response.headers)))
        with self._conn:
            self._conn.execute("DELETE FROM cache WHERE key=?", (key, ))
            self._conn.execute("INSERT INTO cache VALUES (?,?,?,?,?,?)", rec)