feat: set express_redis_cache_name in home or other routes
This commit is contained in:
parent
272f4a5389
commit
e0b02b86ec
1 changed files with 11 additions and 1 deletions
12
src/app.ts
12
src/app.ts
|
@ -101,6 +101,7 @@ let main = async () => {
|
||||||
app.get(
|
app.get(
|
||||||
'/',
|
'/',
|
||||||
(req, res, next) => {
|
(req, res, next) => {
|
||||||
|
res.express_redis_cache_name = req.path
|
||||||
if (process.env.OPEN_DATE == null) {
|
if (process.env.OPEN_DATE == null) {
|
||||||
next()
|
next()
|
||||||
return
|
return
|
||||||
|
@ -124,10 +125,19 @@ let main = async () => {
|
||||||
cache.route('/home', cacheDuration.home),
|
cache.route('/home', cacheDuration.home),
|
||||||
PublicController.home
|
PublicController.home
|
||||||
)
|
)
|
||||||
app.get('/c', cache.route('/c', cacheDuration.countdown), PublicController.countdown)
|
app.get(
|
||||||
|
'/c',
|
||||||
|
(req, res, next) => {
|
||||||
|
res.express_redis_cache_name = req.path
|
||||||
|
next()
|
||||||
|
},
|
||||||
|
cache.route('/c', cacheDuration.countdown),
|
||||||
|
PublicController.countdown
|
||||||
|
)
|
||||||
app.get(
|
app.get(
|
||||||
'/association/:slug',
|
'/association/:slug',
|
||||||
(req, res, next) => {
|
(req, res, next) => {
|
||||||
|
res.express_redis_cache_name = req.path
|
||||||
// disable cache if proposed in query
|
// disable cache if proposed in query
|
||||||
let isProposed = Utils.isStrUsable(req.query, 'version')
|
let isProposed = Utils.isStrUsable(req.query, 'version')
|
||||||
if (isProposed) {
|
if (isProposed) {
|
||||||
|
|
Loading…
Reference in a new issue