Spaces:
Running
Running
Download backend/omr-service/src/lib/dbSolutionStore.ts from k-l-lambda/starry: direct link, hf CLI and curl.
- Browser
- Download file 618 Bytes
-
https://huggingface.co/spaces/k-l-lambda/starry/resolve/main/backend/omr-service/src/lib/dbSolutionStore.ts
- Command line
-
hf download hf://spaces/k-l-lambda/starry/backend/omr-service/src/lib/dbSolutionStore.ts
-
curl -L -o dbSolutionStore.ts https://huggingface.co/spaces/k-l-lambda/starry/resolve/main/backend/omr-service/src/lib/dbSolutionStore.ts
618 Bytes
| 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); | |
| }, | |
| }; | |