(key: string, value: NewsItem[])
| 21 | } |
| 22 | |
| 23 | async set(key: string, value: NewsItem[]) { |
| 24 | const now = Date.now() |
| 25 | await this.db.prepare( |
| 26 | `INSERT OR REPLACE INTO cache (id, data, updated) VALUES (?, ?, ?)`, |
| 27 | ).run(key, JSON.stringify(value), now) |
| 28 | logger.success(`set ${key} cache`) |
| 29 | } |
| 30 | |
| 31 | async get(key: string): Promise<CacheInfo | undefined > { |
| 32 | const row = (await this.db.prepare(`SELECT id, data, updated FROM cache WHERE id = ?`).get(key)) as CacheRow | undefined |
no outgoing calls
no test coverage detected