MCPcopy Create free account
hub / github.com/ProtonDriveApps/sdk / NullCache

Class NullCache

client/js/src/cache/nullCache.ts:8–38  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6 * This cache is not caching anything. It can be used to disable the cache.
7 */
8export class NullCache<T> implements ProtonDriveCache<T> {
9 async clear() {
10 // No-op.
11 }
12
13 // eslint-disable-next-line @typescript-eslint/no-unused-vars
14 async setEntity(key: string, value: T, tags?: string[]) {
15 // No-op.
16 }
17
18 // eslint-disable-next-line @typescript-eslint/no-unused-vars
19 async getEntity(key: string): Promise<T> {
20 throw Error('Entity not found');
21 }
22
23 async *iterateEntities(keys: string[]): AsyncGenerator<EntityResult<T>> {
24 for (const key of keys) {
25 yield { key, ok: false, error: 'Entity not found' };
26 }
27 }
28
29 // eslint-disable-next-line @typescript-eslint/no-unused-vars
30 async *iterateEntitiesByTag(tag: string): AsyncGenerator<EntityResult<T>> {
31 // No-op.
32 }
33
34 // eslint-disable-next-line @typescript-eslint/no-unused-vars
35 async removeEntities(keys: string[]) {
36 // No-op.
37 }
38}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected