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

Class BethMemoryCache

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

Source from the content-addressed store, hash-verified

74};
75
76class BethMemoryCache implements StoredCache {
77 private cache: Map<string, any>;
78 constructor() {
79 this.cache = new Map();
80 }
81 public get(key: string) {
82 const result = this.cache.get(key);
83 if (result) {
84 return result;
85 } else {
86 throw new Error(
87 `No entry found in memory cache when one was expected: ${key}`,
88 );
89 }
90 }
91 public set(key: string, value: any) {
92 this.cache.set(key, value);
93 }
94}
95class BethJsonCache implements StoredCache {
96 private db: Database;
97 constructor() {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected