22 lines
675 B
TypeScript
22 lines
675 B
TypeScript
import { createSharedStore, type SharedStore } from "@hivegrid/shared-store";
|
|
|
|
let cachedStore: SharedStore | null = null;
|
|
let factory: () => SharedStore = () => createSharedStore({ namespace: "mcp", redisUrl: process.env.REDIS_URL });
|
|
|
|
export function getMcpSharedStore(): SharedStore {
|
|
if (cachedStore === null) {
|
|
cachedStore = factory();
|
|
}
|
|
return cachedStore;
|
|
}
|
|
|
|
export function __setMcpSharedStoreFactoryForTests(next: () => SharedStore): void {
|
|
factory = next;
|
|
cachedStore = null;
|
|
}
|
|
|
|
export function __resetMcpSharedStoreForTests(): void {
|
|
factory = () => createSharedStore({ namespace: "mcp", redisUrl: process.env.REDIS_URL });
|
|
cachedStore = null;
|
|
}
|