docs: def add_document(self, doc_url, data):
          """ Add the given document to the cache, updating
          the existing content data if the document is already present
  
          :type doc_url: String or Document
          :param doc_url: the URL of the document, or a Document object
          :type data: String
          :param data: the document's content data
  
  
          """
          file_path = self.__generate_filepath()
          with open(file_path, 'wb') as f:
              f.write(data)
  
          c = self.conn.cursor()
          c.execute("SELECT * FROM documents WHERE url=?", (str(doc_url),))
          for row in c.fetchall():
              old_file_path = row[1]
              if os.path.isfile(old_file_path):
                  os.unlink(old_file_path)
          c.execute("DELETE FROM documents WHERE url=?", (str(doc_url),))
          self.conn.commit()
          c.execute("INSERT INTO documents VALUES (?, ?, ?)",
                    (str(doc_url), file_path, self.__now_iso_8601()))
          self.conn.commit()
          c.close()