1
0
forked from firka/firka

tt: update cache retention to 4 months

This commit is contained in:
2025-08-24 11:49:03 +02:00
parent 1ce4368dc6
commit 92f4fac2a6
3 changed files with 5 additions and 5 deletions

View File

@@ -318,12 +318,12 @@ class KretaClient {
}
}
// only cache stuff in a 1 month frame
// only cache stuff 4 months ago and a week in advance
if (from.millisecondsSinceEpoch >=
now.subtract(Duration(days: 30)).millisecondsSinceEpoch) {
now.subtract(Duration(days: 120)).millisecondsSinceEpoch) {
if (to == null ||
to.millisecondsSinceEpoch <=
now.add(Duration(days: 30)).millisecondsSinceEpoch) {
now.add(Duration(days: 7)).millisecondsSinceEpoch) {
await isar.writeTxn(() async {
await storeCache(resp, cacheKey);
});

View File

@@ -19,7 +19,7 @@ Future<void> resetOldHomeworkCache(Isar isar) async {
var date = getDate(week.cacheKey!);
if (date.millisecondsSinceEpoch <
now.subtract(Duration(days: 30)).millisecondsSinceEpoch) {
now.subtract(Duration(days: 120)).millisecondsSinceEpoch) {
weeksToRemove.add(week.cacheKey!);
}
}

View File

@@ -19,7 +19,7 @@ Future<void> resetOldTimeTableCache(Isar isar) async {
var date = getDate(week.cacheKey!);
if (date.millisecondsSinceEpoch <
now.subtract(Duration(days: 30)).millisecondsSinceEpoch) {
now.subtract(Duration(days: 120)).millisecondsSinceEpoch) {
weeksToRemove.add(week.cacheKey!);
}
}