mirror of
https://github.com/tdurieux/anonymous_github.git
synced 2026-10-20 06:37:23 +02:00
feat: increase caching when file version is provided
This commit is contained in:
1 parent
593dbed822
commit
968a59726c
1 file changed
+7
-2
@@ -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) {
|
||||
|
||||
Reference in new issue
Block a user