Skip to content

Commit

Permalink
Minor updates
Browse files Browse the repository at this point in the history
Changed PromoVideos redis keyname, using mal_id now
Changed schedule key TTL from 2 to 6 hours
  • Loading branch information
Darkangeel-hd committed Apr 14, 2023
1 parent 7c6307c commit cef7574
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions src/controllers/AnimeController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
);
}

Expand Down
12 changes: 6 additions & 6 deletions src/utils/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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,
);
}

Expand Down

0 comments on commit cef7574

Please sign in to comment.