forked from tinygrad/tinygrad
call VACUUM in diskcache_clear (#7588)
reclaims the db space after DROP TABLE
This commit is contained in:
+1
-1
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user