From cef7574083f5a7febb2805c9352f1358cb26dae4 Mon Sep 17 00:00:00 2001 From: Darkangeel_hd Date: Sat, 15 Apr 2023 00:55:10 +0200 Subject: [PATCH] Minor updates Changed PromoVideos redis keyname, using mal_id now Changed schedule key TTL from 2 to 6 hours --- src/controllers/AnimeController.ts | 6 +++--- src/utils/util.ts | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/controllers/AnimeController.ts b/src/controllers/AnimeController.ts index 7d8724e..f7822f5 100644 --- a/src/controllers/AnimeController.ts +++ b/src/controllers/AnimeController.ts @@ -119,11 +119,11 @@ export default class AnimeController { JSON.stringify({ day: animeList }), ); - /* After 24hrs expire the key. */ + /* After 6hrs expire the key. */ - redisClient.expireat( + redisClient.expire( `schedule_${hashStringMd5(day)}`, - parseInt(`${+new Date() / 1000}`, 10) + 7200, + + 21600, ); } diff --git a/src/utils/util.ts b/src/utils/util.ts index 544abf8..a85fad1 100644 --- a/src/utils/util.ts +++ b/src/utils/util.ts @@ -134,7 +134,7 @@ export const getAnimeVideoPromo = async (mal_id: number) => { try { if (redisClient.connected) { const resultQueryRedis: any = await redisClient.get( - `promoInfo_${hashStringMd5(`${mal_id}`)}`, + `getMALpromoInfo_${mal_id}`, ); if (resultQueryRedis) { @@ -165,15 +165,15 @@ export const getAnimeVideoPromo = async (mal_id: number) => { /* Set the key in the redis cache. */ redisClient.set( - `promoInfo_${hashStringMd5(`${mal_id}`)}`, + `getMALpromoInfo_${mal_id}`, JSON.stringify(promo), ); - /* After 24hrs expire the key. */ + /* After 2hrs expire the key. */ - redisClient.expireat( - `promoInfo_${hashStringMd5(`${mal_id}`)}`, - parseInt(`${+new Date() / 1000}`, 10) + 7200, + redisClient.expire( + `getMALpromoInfo_${mal_id}`, + 7200, ); }