def METHOD_NAME(self, url, image_data):
    con = lite.connect(self.db_file)
    with con:
        cur = con.cursor()
        timestamp = datetime.datetime.now()
        tmp_fd, filename = tempfile.mkstemp(
            dir=self.cache_folder, prefix="img")
        f = os.fdopen(tmp_fd, 'w+b')
        f.write(image_data)
        f.close()
        cur.execute("INSERT or REPLACE INTO Images VALUES(?, ?, ?)",
                    (url,
                     filename,
                     timestamp)
                    )