A PHP internals mailing list discussion about a proposed RFC for OPcache Static Cache — an OPcache-managed shared-memory cache for userland values and PHP static state. The RFC introduces volatile and persistent backends with new OPcache namespace functions and attributes (#[OPcache\VolatileStatic] and #[OPcache\PersistentStatic]) that allow static properties and method static variables to survive across requests. Key discussion points include API design concerns (lock symmetry, atomic decrement behavior, status API returning objects vs arrays), the default-off setting and its impact on library adoption, shared-hosting tenant isolation challenges, and multi-library key-space collision risks. The RFC author updated the proposal to address several concrete issues: adding unlock() functions, lease-based lock expiry, read-only status objects, and per-entry cache deletion without full backend purge.

2h 41m read timeFrom externals.io
Post cover image
Table of contents
The resulting public APISAPI availability: the unsafe flag is gone, opt-in insteadAPI shape: remember()References and the silent fallbackScalars and arrays-of-scalars onlyDropping pinned (and the attributes)Where this leaves usJakub: the FPM pool boundary is preservedTimo: thanks for the immutable_cache pointer
301 Impressions