MCPcopy Create free account
hub / github.com/ethanniser/the-beth-stack / BethPersistedCache

Class BethPersistedCache

packages/beth-stack/src/cache/new-persist.ts:140–204  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

138}
139
140export class BethPersistedCache {
141 private config: GlobalCacheConfig = startingConfig;
142 private primaryMap: Map<
143 FunctionKey,
144 {
145 callBack: () => Promise<any>;
146 tags: string[];
147 location: "memory" | "json";
148 argsMap: Map<
149 any[],
150 {
151 argsKey: ArgKey;
152 status:
153 | "pending"
154 | "unseeded"
155 | "seeded"
156 | "unseeded-error"
157 | "seeded-error";
158 }
159 >;
160 }
161 > = new Map();
162 private pendingMap: Map<ArgKey, Promise<any>> = new Map();
163 private erroredMap: Map<ArgKey, any> = new Map();
164 private inMemoryDataCache: BethMemoryCache = new BethMemoryCache();
165 private jsonDataCache: BethJsonCache = new BethJsonCache();
166 private intervals: Set<Timer> = new Set();
167 private keys: Set<string> = new Set();
168
169 constructor() {}
170
171 public setConfig(config: Partial<GlobalCacheConfig>): void {}
172
173 public clearAllIntervals(): void {
174 this.intervals.forEach((interval) => clearInterval(interval));
175 }
176 public purgeAllCachedData(): void {
177 this.primaryMap = new Map();
178 this.erroredMap = new Map();
179 this.inMemoryDataCache = new BethMemoryCache();
180 this.jsonDataCache = new BethJsonCache();
181 this.primaryMap.forEach((fnData, key) => {
182 fnData.argsMap.forEach((fnData, key) => {
183 fnData.status = "unseeded";
184 });
185 });
186 }
187
188 public initializeEntry(
189 callBack: () => Promise<any>,
190 key: FunctionKey,
191 options?: CacheOptions,
192 ): void {}
193 public getCachedValue(key: string, ...args: any[]): any {}
194
195 public async revalidateTag(tag: string): Promise<void> {}
196
197 private logDebug(): void {}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected