seperating batch payload from job queue
This commit is contained in:
parent
c57733ebca
commit
b974753d8b
5 changed files with 360 additions and 25 deletions
21
libs/cache/src/providers/memory-cache.ts
vendored
21
libs/cache/src/providers/memory-cache.ts
vendored
|
|
@ -256,4 +256,25 @@ export class MemoryCache implements CacheProvider {
|
|||
}
|
||||
return bytes;
|
||||
}
|
||||
|
||||
async waitForReady(timeout: number = 5000): Promise<void> {
|
||||
// Memory cache is always ready immediately
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
isReady(): boolean {
|
||||
// Memory cache is always ready
|
||||
return true;
|
||||
}
|
||||
|
||||
private getMemoryUsage(): number {
|
||||
// Rough estimation of memory usage in bytes
|
||||
let bytes = 0;
|
||||
for (const [key, entry] of this.store.entries()) {
|
||||
bytes += key.length * 2; // UTF-16 characters
|
||||
bytes += JSON.stringify(entry.value).length * 2;
|
||||
bytes += 24; // Overhead for entry object
|
||||
}
|
||||
return bytes;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue