feat: increase caching when file version is provided

This commit is contained in:
tdurieux
2024-04-06 10:05:07 +01:00
parent 593dbed822
commit 968a59726c

View File

@@ -52,8 +52,13 @@ router.get(
anonymizedPath.substring(anonymizedPath.lastIndexOf("/") + 1)
);
}
// cache the file for 5min
res.header("Cache-Control", "max-age=300");
if (req.query.v) {
// cache the file for a month
res.header("Cache-Control", "max-age=18144000");
} else {
// cache the file for 5min
res.header("Cache-Control", "max-age=300");
}
await repo.countView();
await f.send(res);
} catch (error) {