Context / Problem
FoundationDB keeps a static cache of Database objects that is never evicted except by an explicit close():
src/FoundationDB.php:16-17 — private static array $databases = [];
src/FoundationDB.php:98-115 — openWithConnectionString() caches by 'conn:' . $connectionString
An application that opens many distinct cluster files or connection strings (multi-tenant, dynamic connection strings) holds a growing number of native FDBDatabase handles for the entire process lifetime.
Affected files / locations
- src/FoundationDB.php:16-17,59-116
Proposed approach
Document that cached databases live for the process lifetime and require close(), and bound the growth: either do not cache the connection-string variant, or apply a small bounded cache with explicit eviction. Ensure evicted databases are properly destroyed.
Acceptance Criteria
Severity
Medium
Context / Problem
FoundationDBkeeps a static cache ofDatabaseobjects that is never evicted except by an explicitclose():An application that opens many distinct cluster files or connection strings (multi-tenant, dynamic connection strings) holds a growing number of native FDBDatabase handles for the entire process lifetime.
Affected files / locations
Proposed approach
Document that cached databases live for the process lifetime and require
close(), and bound the growth: either do not cache the connection-string variant, or apply a small bounded cache with explicit eviction. Ensure evicted databases are properly destroyed.Acceptance Criteria
Severity
Medium