Remove unnecesary key only clearing for cache clearing

This commit is contained in:
Joe 2024-11-26 19:52:21 -08:00
parent 1395c0b8c6
commit 309157dd89

View File

@ -443,17 +443,11 @@ export class FilterHelper {
/** /**
* Clears fuzzy search caches * Clears fuzzy search caches
* @param {keyof typeof fuzzySearchCategories} [type] Optional cache type to clear. If not provided, clears all caches
*/ */
clearFuzzySearchCaches(type = null) { clearFuzzySearchCaches() {
if (type && this.fuzzySearchCaches[type]) { for (const cache of Object.values(this.fuzzySearchCaches)) {
this.fuzzySearchCaches[type].resultMap.clear(); cache.resultMap.clear();
console.log(`Fuzzy search cache cleared for: ${type}`);
} else {
for (const cache of Object.values(this.fuzzySearchCaches)) {
cache.resultMap.clear();
}
console.log('All fuzzy search caches cleared');
} }
console.log('All fuzzy search caches cleared');
} }
} }