[php-src] PR #22730: [RFC] Add ext-user_cache bundled extension

From: Date: Tue, 14 Jul 2026 16:28:24 +0000
Subject: [php-src] PR #22730: [RFC] Add ext-user_cache bundled extension
Groups: php.git-pulls 
Request: Send a blank email to git-pulls+get-37043@lists.php.net to get a copy of this message
Pull Request: https://github.com/php/php-src/pull/22730 Author: zeriyoshi RFC: WIP This PR introduces a new built-in extension, ext-user_cache, to PHP. It replaces the earlier OPcache Static Cache (#22534) and OPcache User Cache (#22052) proposals. It is a refined version whose design has been completely rethought and reimplemented from scratch, rather than carried over from the previous proposals. The previous discussion of the OPcache Static Cache can be found on the internals mailing list (externals.io): https://externals.io/message/130912 ext-user_cache provides high-performance caching that persists across request boundaries. Values are stored in and retrieved from pre-allocated shared memory (SHM) through one of the following paths: - Scalar values are copied directly. - Objects that can use a shared graph representation are converted to that representation and copied. - Internal or extension classes that have a safe direct-conversion (safe direct) path (e.g. ext-date, ext-spl) are converted to a shared graph representation and copied. - Values with certain magic methods such as __serialize are serialized with a fast internal serializer and then copied. - Unsupported values result in an error. The extension is enabled by default and enforces appropriate security boundaries for each SAPI. Even when it is disabled, libraries can continue to use it transparently; they simply gain no caching benefit. The extension is designed specifically for fetch-heavy workloads, so its write performance is lower than that of existing third-party extensions. However, I believe this trade-off is acceptable given the nature of caching. Detailed benchmarks and their test suites are available here: - harness: https://github.com/colopl/php-user_cache_benchmark_harness - benchmark results: https://colopl.github.io/php-user_cache_benchmark_harness/ - arm64 (aarch64) Ubuntu 24.04 with OrbStack on MacBook Air M4 (RAM 32G)

« previous php.git-pulls (#37043) next »