Skip to content

Commit

Permalink
update: keys for caching
Browse files Browse the repository at this point in the history
  • Loading branch information
hexdecimal16 committed Aug 21, 2024
1 parent bea4124 commit d84f164
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/utils/ratingScrapers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export async function getRatingsFromGoogle(query: string, imdbId: string, cacheC
}
// Cache the ratings if available
for (const [key, value] of Object.entries(ratings)) {
const cacheKey = `${imdbId}:${key}`;
const cacheKey = `${imdbId}_${key}_v1.0`;
console.log('Caching:', cacheKey, value);
await cacheClient?.set(cacheKey, value);
await cacheClient?.expire(cacheKey, 86400); // Cache for 1 day
Expand All @@ -36,7 +36,7 @@ export async function getRatingsFromBing(query: string, imdbId: string, cacheCli
}
// Cache the ratings if available
for (const [key, value] of Object.entries(ratings)) {
const cacheKey = `${imdbId}:${key}`;
const cacheKey = `${imdbId}_${key}_v1.0`;
console.log('Caching:', cacheKey, value);
await cacheClient?.set(cacheKey, value);
await cacheClient?.expire(cacheKey, 86400); // Cache for 1 day
Expand All @@ -58,7 +58,7 @@ export async function getRatingsFromYahoo(query: string, imdbId: string, cacheCl
}
// Cache the ratings if available
for (const [key, value] of Object.entries(ratings)) {
const cacheKey = `${imdbId}:${key}`;
const cacheKey = `${imdbId}_${key}_v1.0`;
console.log('Caching:', cacheKey, value);
await cacheClient?.set(cacheKey, value);
await cacheClient?.expire(cacheKey, 86400); // Cache for 1 day
Expand Down

0 comments on commit d84f164

Please sign in to comment.