tweak backend by allowing feed ids to have their TTL reset

This commit is contained in:
ld3zian 2025-02-02 14:52:30 -07:00
parent 07d245e94d
commit b8499d90c6

View file

@ -110,7 +110,7 @@ export async function storeFeedMapping(feedId: string, slugs: string[], lang: st
feedId,
JSON.stringify(mapping),
'EX',
DEFAULT_CACHE_TTL // Use the constant here
DEFAULT_CACHE_TTL
);
} catch (error) {
console.error('Error storing feed mapping:', error);
@ -128,6 +128,8 @@ export async function getFeedMapping(feedId: string): Promise<FeedMapping | null
const mapping = await redis.get(feedId);
if (!mapping) return null;
await redis.expire(feedId, DEFAULT_CACHE_TTL);
const data = JSON.parse(mapping);
return {
slugs: data.slugs,