File size: 618 Bytes
6f1c297
 
 
 
 
 
 
 
 
ad438b8
 
 
 
 
6f1c297
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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);
	},
};