style: format code biome
Local Build and Deploy / deploy (push) Failing after 46s

This commit is contained in:
openhands committed 2026-07-13 21:57:41 +02:00
1 parent 8efd032cc6
commit df38dccbf1
735 files changed
+128321 -120870

No files matched your search

+14 -10
View File
@@ -1,17 +1,21 @@
type CacheEntry<T> = { data: T; expiresAt: number };
const store = new Map<string, CacheEntry<unknown>>();
export function cached<T>(key: string, ttlMs: number, fn: () => Promise<T>): Promise<T> {
const existing = store.get(key);
if (existing && existing.expiresAt > Date.now()) {
return Promise.resolve(existing.data as T);
}
return fn().then((data) => {
store.set(key, { data, expiresAt: Date.now() + ttlMs });
return data;
});
export function cached<T>(
key: string,
ttlMs: number,
fn: () => Promise<T>,
): Promise<T> {
const existing = store.get(key);
if (existing && existing.expiresAt > Date.now()) {
return Promise.resolve(existing.data as T);
}
return fn().then((data) => {
store.set(key, { data, expiresAt: Date.now() + ttlMs });
return data;
});
}
export function bustCache(key: string): void {
store.delete(key);
store.delete(key);
}