starry / backend /omr-service /src /lib /dbSolutionStore.ts
k-l-lambda's picture
update: export from starry-refactor 2026-02-21 (add example score seed)
ad438b8
import * as solutionCacheService from '../services/solutionCache.service.js';
// DB-backed SolutionStore using the solution_cache table (JSONB column, auto-parsed by pg driver)
export const DbSolutionStore = {
async get(key: string) {
const [result] = await solutionCacheService.batchGet([key]);
return result ?? null;
},
async set(key: string, val: any) {
try {
await solutionCacheService.set(key, val);
} catch (err) {
console.error('[DbSolutionStore] set failed (non-fatal):', (err as Error).message);
}
},
async batchGet(keys: string[]) {
return solutionCacheService.batchGet(keys);
},
};