UNPKG

@noony-serverless/core

Version:

A Middy base framework compatible with Firebase and GCP Cloud Functions with TypeScript

44 lines 1.27 kB
import { ContainerInstance } from 'typedi'; /** * Performance optimization: Container Pool for reusing TypeDI containers * This reduces object creation overhead and improves memory efficiency */ declare class ContainerPool { private availableContainers; private maxPoolSize; private createdContainers; constructor(maxPoolSize?: number); /** * Get a container from the pool or create a new one */ acquire(): ContainerInstance; /** * Return a container to the pool for reuse */ release(container: ContainerInstance): void; /** * Reset container state to prevent cross-request contamination * Note: TypeDI containers are isolated by default, so we mainly need * to clear any manually set values */ private resetContainer; /** * Get pool statistics for monitoring */ getStats(): { available: number; created: number; maxSize: number; }; /** * Warm up the pool by pre-creating containers */ warmUp(count?: number): void; /** * Clear all containers from the pool */ clear(): void; } declare const containerPool: ContainerPool; export { ContainerPool, containerPool }; //# sourceMappingURL=containerPool.d.ts.map