feat: migrate some more stuff to svelte-5, mainly app settings
Some checks failed
Deploy to GitHub Pages / build_site (push) Failing after 4s
Some checks failed
Deploy to GitHub Pages / build_site (push) Failing after 4s
This commit is contained in:
19
app/src/lib/runtime/runtime-executor-cache.ts
Normal file
19
app/src/lib/runtime/runtime-executor-cache.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
import { type SyncCache } from "@nodes/types";
|
||||
|
||||
export class MemoryRuntimeCache implements SyncCache {
|
||||
|
||||
private cache: [string, unknown][] = [];
|
||||
size = 50;
|
||||
|
||||
get<T>(key: string): T | undefined {
|
||||
return this.cache.find(([k]) => k === key)?.[1] as T;
|
||||
}
|
||||
set<T>(key: string, value: T): void {
|
||||
this.cache.push([key, value]);
|
||||
this.cache = this.cache.slice(-this.size);
|
||||
}
|
||||
clear(): void {
|
||||
this.cache = [];
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user