MCPcopy
hub / github.com/ourongxing/newsnow / set

Method set

server/database/cache.ts:23–29  ·  view source on GitHub ↗
(key: string, value: NewsItem[])

Source from the content-addressed store, hash-verified

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

Callers 7

NewsCardFunction · 0.80
useEntireQueryFunction · 0.80
setSourceUpdatedAtFunction · 0.80
date.test.tsFile · 0.80
defineRSSHubSourceFunction · 0.80
parseRelativeDateFunction · 0.80
index.tsFile · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected