add cache cleaning queries

This commit is contained in:
Zynh Ludwig 2024-11-21 11:06:41 -08:00
parent 923103c5ef
commit ec6b1b6477
2 changed files with 12 additions and 0 deletions

View file

@ -0,0 +1,5 @@
DELETE FROM records
WHERE
downloads >= max_downloads
OR julianday('now') - julianday(uploaded) > 3
RETURNING cache_name;

View file

@ -0,0 +1,7 @@
SELECT
cache_name,
downloads,
max_downloads,
julianday('now') - julianday(uploaded) AS age
FROM records
WHERE downloads >= max_downloads OR age > 5;