| 74 | }; |
| 75 | |
| 76 | class 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 | } |
| 95 | class BethJsonCache implements StoredCache { |
| 96 | private db: Database; |
| 97 | constructor() { |
nothing calls this directly
no outgoing calls
no test coverage detected