Persistent server search cache: 200 results per query, 250k queries, 15-day stale-while-revalidate, refresh=1
This commit is contained in:
11
server/db.js
11
server/db.js
@@ -112,6 +112,17 @@ export async function initDb() {
|
||||
CREATE INDEX IF NOT EXISTS idx_media_lru
|
||||
ON media_cache (status, last_access);
|
||||
|
||||
-- Persistent search cache: the YouTube part of a search (up to 200 cards,
|
||||
-- JSON), keyed by the lowercased query. Trimmed LRU by count and bytes.
|
||||
CREATE TABLE IF NOT EXISTS search_cache (
|
||||
q TEXT PRIMARY KEY,
|
||||
results TEXT NOT NULL,
|
||||
size INTEGER NOT NULL DEFAULT 0,
|
||||
fetched_at INTEGER NOT NULL DEFAULT 0,
|
||||
last_access INTEGER NOT NULL DEFAULT 0
|
||||
);
|
||||
CREATE INDEX IF NOT EXISTS idx_search_cache_lru ON search_cache (last_access);
|
||||
|
||||
-- Shared per-video documents (kind = lyrics | chapters), visible to every
|
||||
-- user. The live copy is here; every save also lands in video_note_revs
|
||||
-- as a full snapshot, which is the server-side backup and undo history.
|
||||
|
||||
Reference in New Issue
Block a user