List of manga titles to clear from cache.
Object with count of cleared entries and remaining cache size.
export function clearCacheForTitles(titles: string[]): {
clearedCount: number;
remainingCacheSize: number;
titlesWithNoCache: number;
} {
console.log(`Clearing cache for ${titles.length} manga titles...`);
let clearedCount = 0;
let titlesWithNoCache = 0;
// Clear each title's cache entry
for (const title of titles) {
const cacheKey = generateCacheKey(title);
if (mangaCache[cacheKey]) {
delete mangaCache[cacheKey];
clearedCount++;
} else {
titlesWithNoCache++;
}
}
// Save the updated cache to localStorage
if (clearedCount > 0) {
saveCache();
}
console.log(
`Cleared ${clearedCount} cache entries (${titlesWithNoCache} titles had no existing cache entries)`,
);
return {
clearedCount,
remainingCacheSize: Object.keys(mangaCache).length,
titlesWithNoCache,
};
}
Clear cache for multiple manga titles at once. Use this when doing a batch rematch operation with bypassCache=true.