mirror of
https://github.com/tdurieux/anonymous_github.git
synced 2026-07-06 21:57:57 +02:00
feat: increase caching when file version is provided
This commit is contained in:
@@ -52,8 +52,13 @@ router.get(
|
|||||||
anonymizedPath.substring(anonymizedPath.lastIndexOf("/") + 1)
|
anonymizedPath.substring(anonymizedPath.lastIndexOf("/") + 1)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
// cache the file for 5min
|
if (req.query.v) {
|
||||||
res.header("Cache-Control", "max-age=300");
|
// 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 repo.countView();
|
||||||
await f.send(res);
|
await f.send(res);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
Reference in New Issue
Block a user