MCPcopy Create free account
hub / github.com/cisco/mindmeld / flush_to_disk

Method flush_to_disk

mindmeld/query_cache.py:90–103  ·  view source on GitHub ↗

Flushes data from the in-memory cache into the disk-backed cache

(self)

Source from the content-addressed store, hash-verified

88 self.batch_writes = None
89
90 def flush_to_disk(self):
91 """
92 Flushes data from the in-memory cache into the disk-backed cache
93 """
94 logger.info("Flushing %s queries from in-memory cache to disk", len(self.batch_writes))
95 rows = self.memory_connection.execute(f"""
96 SELECT hash_id, query, raw_query, domain, intent FROM queries
97 WHERE rowid IN ({",".join(self.batch_writes)});
98 """)
99 self.disk_connection.executemany("""
100 INSERT OR IGNORE into queries values (?, ?, ?, ?, ?);
101 """, rows)
102 self.disk_connection.commit()
103 self.batch_writes = []
104
105 def __del__(self):
106 if self.memory_connection and self.batch_writes:

Callers 2

__del__Method · 0.95
putMethod · 0.95

Calls 1

executeMethod · 0.45

Tested by

no test coverage detected