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, ); }