feat(app): allow disabling of runtime/registry caches
All checks were successful
Deploy to GitHub Pages / build_site (push) Successful in 1m58s

This commit is contained in:
2026-01-19 14:22:14 +01:00
parent 83cb2bd950
commit 11de746c01
6 changed files with 52 additions and 2 deletions

View File

@@ -64,7 +64,7 @@ export class MemoryRuntimeExecutor implements RuntimeExecutor {
constructor( constructor(
private registry: NodeRegistry, private registry: NodeRegistry,
private cache?: SyncCache<Int32Array>, public cache?: SyncCache<Int32Array>,
) { ) {
this.cache = undefined; this.cache = undefined;
} }

View File

@@ -13,6 +13,22 @@ const executor = new MemoryRuntimeExecutor(nodeRegistry, cache);
const performanceStore = createPerformanceStore(); const performanceStore = createPerformanceStore();
executor.perf = performanceStore; executor.perf = performanceStore;
export async function setUseRegistryCache(useCache: boolean) {
if (useCache) {
nodeRegistry.cache = indexDbCache;
} else {
nodeRegistry.cache = undefined;
}
}
export async function setUseRuntimeCache(useCache: boolean) {
if (useCache) {
executor.cache = cache;
} else {
executor.cache = undefined;
}
}
export async function executeGraph( export async function executeGraph(
graph: Graph, graph: Graph,
settings: Record<string, unknown>, settings: Record<string, unknown>,

View File

@@ -11,5 +11,11 @@ export class WorkerRuntimeExecutor implements RuntimeExecutor {
async getPerformanceData() { async getPerformanceData() {
return this.worker.getPerformanceData(); return this.worker.getPerformanceData();
} }
set useRuntimeCache(useCache: boolean) {
this.worker.setUseRuntimeCache(useCache);
}
set useRegistryCache(useCache: boolean) {
this.worker.setUseRegistryCache(useCache);
}
} }

View File

@@ -87,6 +87,19 @@ export const AppSettingTypes = {
label: "Show Graph Source", label: "Show Graph Source",
value: false, value: false,
}, },
cache: {
title: "Cache",
useRuntimeCache: {
type: "boolean",
label: "Node Results",
value: true,
},
useRegistryCache: {
type: "boolean",
label: "Node Source",
value: true,
},
},
stressTest: { stressTest: {
title: "Stress Test", title: "Stress Test",
amount: { amount: {

View File

@@ -42,6 +42,21 @@
appSettings.value.debug.useWorker ? workerRuntime : memoryRuntime, appSettings.value.debug.useWorker ? workerRuntime : memoryRuntime,
); );
$effect(() => {
if (appSettings.value.debug.cache.useRegistryCache) {
nodeRegistry.cache = registryCache;
} else {
nodeRegistry.cache = undefined;
}
workerRuntime.setUseCache(appSettings.value.debug.cache.useRuntimeCache);
if (appSettings.value.debug.cache.useRuntimeCache) {
memoryRuntime.cache = runtimeCache;
} else {
memoryRuntime.cache = undefined;
}
});
let activeNode = $state<NodeInstance | undefined>(undefined); let activeNode = $state<NodeInstance | undefined>(undefined);
let scene = $state<Group>(null!); let scene = $state<Group>(null!);

View File

@@ -16,7 +16,7 @@ export class RemoteNodeRegistry implements NodeRegistry {
constructor( constructor(
private url: string, private url: string,
private cache?: AsyncCache<ArrayBuffer | string>, public cache?: AsyncCache<ArrayBuffer | string>,
) { } ) { }
async fetchJson(url: string, skipCache = false) { async fetchJson(url: string, skipCache = false) {