-14
src/index.ts
-14
src/index.ts
···
729
729
}
730
730
}, 60 * 1000); // Check every minute
731
731
732
-
// Hourly purge of specific user cache
733
-
const hourlyUserPurge = setInterval(async () => {
734
-
const now = new Date();
735
-
if (now.getMinutes() === 5) {
736
-
const userId = "U062UG485EE";
737
-
console.log(`Purging cache for user ${userId}`);
738
-
const result = await cache.purgeUserCache(userId);
739
-
console.log(
740
-
`Cache purge for user ${userId}: ${result ? "successful" : "no cache entry found"}`,
741
-
);
742
-
}
743
-
}, 60 * 1000); // Check every minute
744
-
745
732
// Clean up on process exit
746
733
process.on("exit", () => {
747
734
clearInterval(dailyPurge);
748
-
clearInterval(hourlyUserPurge);
749
735
});
750
736
}