feat: Instance grouping and user count

This commit is contained in:
2026-06-28 03:49:50 +07:00
parent 2dd6931425
commit 387fa18927
11 changed files with 281 additions and 25 deletions
+15
View File
@@ -0,0 +1,15 @@
import type { Instance } from "../../shared/types/instance";
import { toInstance } from "./mappers";
import { cachedRead } from "./cachedRead";
import { cacheKeys, policies } from "../cache/policies";
export async function getInstance(worldId: string, instanceId: string): Promise<Instance> {
return cachedRead(
cacheKeys.instance(`${worldId}:${instanceId}`),
policies.instance,
async (vrc) => {
const { data } = await vrc.getInstance({ path: { worldId, instanceId }, throwOnError: true });
return toInstance(data);
},
);
}