AI scaffolded NodeJS version of the App.

This commit is contained in:
2026-04-19 18:54:31 +02:00
parent 4ff0a7205f
commit aca4998da7
27 changed files with 8733 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
type CacheEntry<T> = {
value: T;
expiresAt: number;
};
export class MemoryCache {
private readonly store = new Map<string, CacheEntry<unknown>>();
public get<T>(key: string): T | undefined {
const hit = this.store.get(key);
if (!hit) {
return undefined;
}
if (Date.now() >= hit.expiresAt) {
this.store.delete(key);
return undefined;
}
return hit.value as T;
}
public set<T>(key: string, value: T, ttlMs: number): void {
this.store.set(key, {
value,
expiresAt: Date.now() + ttlMs
});
}
}