feat(app): allow disabling of runtime/registry caches
All checks were successful
Deploy to GitHub Pages / build_site (push) Successful in 1m58s
All checks were successful
Deploy to GitHub Pages / build_site (push) Successful in 1m58s
This commit is contained in:
@@ -64,7 +64,7 @@ export class MemoryRuntimeExecutor implements RuntimeExecutor {
|
||||
|
||||
constructor(
|
||||
private registry: NodeRegistry,
|
||||
private cache?: SyncCache<Int32Array>,
|
||||
public cache?: SyncCache<Int32Array>,
|
||||
) {
|
||||
this.cache = undefined;
|
||||
}
|
||||
|
||||
@@ -13,6 +13,22 @@ const executor = new MemoryRuntimeExecutor(nodeRegistry, cache);
|
||||
const performanceStore = createPerformanceStore();
|
||||
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(
|
||||
graph: Graph,
|
||||
settings: Record<string, unknown>,
|
||||
|
||||
@@ -11,5 +11,11 @@ export class WorkerRuntimeExecutor implements RuntimeExecutor {
|
||||
async getPerformanceData() {
|
||||
return this.worker.getPerformanceData();
|
||||
}
|
||||
set useRuntimeCache(useCache: boolean) {
|
||||
this.worker.setUseRuntimeCache(useCache);
|
||||
}
|
||||
set useRegistryCache(useCache: boolean) {
|
||||
this.worker.setUseRegistryCache(useCache);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -87,6 +87,19 @@ export const AppSettingTypes = {
|
||||
label: "Show Graph Source",
|
||||
value: false,
|
||||
},
|
||||
cache: {
|
||||
title: "Cache",
|
||||
useRuntimeCache: {
|
||||
type: "boolean",
|
||||
label: "Node Results",
|
||||
value: true,
|
||||
},
|
||||
useRegistryCache: {
|
||||
type: "boolean",
|
||||
label: "Node Source",
|
||||
value: true,
|
||||
},
|
||||
},
|
||||
stressTest: {
|
||||
title: "Stress Test",
|
||||
amount: {
|
||||
|
||||
@@ -42,6 +42,21 @@
|
||||
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 scene = $state<Group>(null!);
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ export class RemoteNodeRegistry implements NodeRegistry {
|
||||
|
||||
constructor(
|
||||
private url: string,
|
||||
private cache?: AsyncCache<ArrayBuffer | string>,
|
||||
public cache?: AsyncCache<ArrayBuffer | string>,
|
||||
) { }
|
||||
|
||||
async fetchJson(url: string, skipCache = false) {
|
||||
|
||||
Reference in New Issue
Block a user