call VACUUM in diskcache_clear (#7588)

reclaims the db space after DROP TABLE
This commit is contained in:
chenyu
2024-11-07 16:55:48 -05:00
committed by GitHub
parent 4378b100ad
commit dc7b0e2bb7
+1 -1
View File
@@ -182,7 +182,7 @@ def db_connection():
def diskcache_clear():
cur = db_connection().cursor()
drop_tables = cur.execute("SELECT 'DROP TABLE IF EXISTS ' || quote(name) || ';' FROM sqlite_master WHERE type = 'table';").fetchall()
cur.executescript("\n".join([s[0] for s in drop_tables]))
cur.executescript("\n".join([s[0] for s in drop_tables] + ["VACUUM;"]))
def diskcache_get(table:str, key:Union[Dict, str, int]) -> Any:
if CACHELEVEL == 0: return None