feat: cache in settings

This commit is contained in:
2023-10-19 19:25:33 +01:00
parent c96ea94bb3
commit 824b6fdce4
8 changed files with 129 additions and 2 deletions

View File

@ -46,6 +46,10 @@ export abstract class FeedCache<TCached> {
this.onTable = new Set<string>(keys.map(a => a as string));
}
keysOnTable() {
return [...this.onTable];
}
hook(fn: HookFn, key: string | undefined) {
if (!key) {
return () => {
@ -190,6 +194,8 @@ export abstract class FeedCache<TCached> {
await this.table?.clear();
this.cache.clear();
this.onTable.clear();
this.#changed = true;
this.#hooks.forEach(h => h.fn());
}
snapshot() {