add cache cleaning queries
This commit is contained in:
parent
923103c5ef
commit
ec6b1b6477
2 changed files with 12 additions and 0 deletions
5
queries/records/delete_expired_records.sql
Normal file
5
queries/records/delete_expired_records.sql
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
DELETE FROM records
|
||||||
|
WHERE
|
||||||
|
downloads >= max_downloads
|
||||||
|
OR julianday('now') - julianday(uploaded) > 3
|
||||||
|
RETURNING cache_name;
|
7
queries/records/get_expired_records.sql
Normal file
7
queries/records/get_expired_records.sql
Normal 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;
|
Loading…
Reference in a new issue