cache fetched content for 24 hours

This commit is contained in:
Hongbo Wu
2024-01-25 17:34:54 +08:00
parent 7e89235806
commit e4e07c8acf

View File

@ -53,8 +53,8 @@ interface FetchResult {
}
export const cacheFetchResult = async (fetchResult: FetchResult) => {
// cache the fetch result for 4 hours
const ttl = 4 * 60 * 60
// cache the fetch result for 24 hours
const ttl = 24 * 60 * 60
const key = `fetch-result:${fetchResult.finalUrl}`
const value = JSON.stringify(fetchResult)
return redisDataSource.cacheClient.set(key, value, 'EX', ttl, 'NX')