Refactor cache module

This commit is contained in:
Schluffe
2026-08-08 14:00:36 +02:00
parent bb071074d2
commit bed4a58cad
7 changed files with 249 additions and 118 deletions
+2 -2
View File
@@ -5,7 +5,7 @@ import {
entityProcessMap,
} from "#/engine/Entity.ts";
import { type Graph, getNeighbours } from "#/engine/Graph.ts";
import { useWithAsyncCache } from "#/engine/lib/cache.ts";
import { type Cache, memoize } from "#/engine/lib/cache.ts";
import MapArray from "#/engine/lib/MapArray.ts";
export type Process = (ctx: CanvasRenderingContext2D, delta: number) => void;
@@ -106,7 +106,7 @@ export function defineScene(data: SceneData): {
};
}
const [loadScene, sceneCache] = useWithAsyncCache(async (name: string) => {
const [loadScene, sceneCache] = memoize(async (name: string) => {
await import(`#/game/scenes/${name}/scene.ts`);
const data = sceneDataMap.get(name)!;