feat: admin log page
This commit is contained in:
10
lib/cache.ts
10
lib/cache.ts
@@ -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());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user