feat: admin log page

This commit is contained in:
2025-01-25 00:00:04 +01:00
parent 979627ca2a
commit 00e7820462
8 changed files with 73 additions and 15 deletions

View File

@@ -48,7 +48,7 @@ export function createCache<T>(
}
},
info(): { count: number; sizeInKB: number } {
info() {
// Cleanup expired entries before calculating info
this.cleanup();
@@ -65,8 +65,8 @@ export function createCache<T>(
totalBytes += keySize + valueSize;
}
const sizeInKB = totalBytes / 1024; // Convert bytes to kilobytes
return { count, sizeInKB };
const sizeInKB = Math.floor(totalBytes / 1024); // Convert bytes to kilobytes
return { name: cacheName, count, sizeInKB };
},
has(key: string): boolean {
@@ -98,3 +98,7 @@ export function createCache<T>(
});
return api;
}
export function getCacheInfo() {
return caches.values().map((c) => c.info());
}