better caching

This commit is contained in:
Michael Freno
2025-12-22 17:38:08 -05:00
parent 11fad35288
commit 541ee5b8b2
3 changed files with 133 additions and 92 deletions

View File

@@ -48,6 +48,17 @@ class SimpleCache {
delete(key: string): void {
this.cache.delete(key);
}
/**
* Delete all keys starting with a prefix
*/
deleteByPrefix(prefix: string): void {
for (const key of this.cache.keys()) {
if (key.startsWith(prefix)) {
this.cache.delete(key);
}
}
}
}
export const cache = new SimpleCache();