symfony/cache
49.4
Weak · 17 November 2026
16k
lines of production code
PHP
primary language
5
measurements over time
What this system is
Features
Add support for Relay extension versions 0.20.0 through 0.50.2
The Relay cache adapter now supports the Relay PHP extension versions 0.20.0, 0.21.0, 0.22.0, 0.30.0, 0.40.0, 0.50.0, and 0.50.2. New trait files have been added to provide compatibility with these versions, exposing methods such as \lmovem\, \blmovem\, \sdiffcard\, \sunioncard\, \himport\, \fcall\, \fcall\_ro\, \clusterscan\, \gcra\, \jsonStrAppend\, \increx\, \xnack\, \unwatch\, \getDbNum\, \move\, and \select\ where available in the respective extension versions. This allows the cache system to utilize newer Relay features and maintain compatibility across a wider range of extension releases.
Traits/Relay · high confidence
Cache integration with Messenger for async value recomputation
Added three new classes in the Cache component's Messenger namespace (EarlyExpirationDispatcher, EarlyExpirationHandler, and EarlyExpirationMessage) that allow cached values to be recomputed asynchronously via a message bus. This enables workers to handle cache stampede protection and early expiration callbacks, reducing synchronous load on the application by offloading expensive cache computations to background workers.
Messenger · high confidence
Introduce new Cache Adapter implementations and interfaces
This change adds a suite of new cache adapter classes to the Adapter component, including abstract base classes like AbstractTagAwareAdapter and AdapterInterface, as well as concrete implementations for various backends: ChainAdapter, CouchbaseCollectionAdapter, DoctrineDbalAdapter, FilesystemAdapter, FilesystemTagAwareAdapter, MemcachedAdapter, MongoDbAdapter, MongoDbTagAwareAdapter, NullAdapter, and PdoAdapter. These adapters provide standardized ways to store and retrieve cached items using different storage systems (filesystem, database, Redis/Memcached/Couchbase/MongoDB) and support features like tag-based invalidation and chaining multiple adapters.
Adapter · high confidence
Introduces extensible cache marshaller system with encryption and compression support
The Cache component now uses a pluggable \MarshallerInterface\ to handle serialization, allowing users to swap the default serializer or add capabilities like compression and encryption. The new \DefaultMarshaller\ provides the baseline serialization (using igbinary when available) and includes a \throwOnSerializationFailure\ option to throw a \ValueError\ in debug mode when serialization fails. For security, the \SodiumMarshaller\ encrypts cache values using libsodium before storage and automatically rejects values it cannot decrypt. For performance, the \DeflateMarshaller\ compresses serialized data using zlib, and the \TagAwareMarshaller\ offers a compact binary format specifically optimized for tag-aware cache adapters.
Marshaller · high confidence
New Cache Data Collector for profiling cache operations
A new CacheDataCollector has been added to the DataCollector component, enabling the profiling and inspection of cache adapter interactions within the web profiler. This collector tracks detailed statistics for cache operations, including reads, writes, deletes, hits, and misses, and calculates hit-to-read ratios. It supports various cache methods such as get, getItem, getItems, hasItem, save, saveDeferred, and deleteItem, providing developers with visibility into cache performance and behavior during request handling.
DataCollector · high confidence
Architecture
Cache traits refactored into dedicated internal classes
The internal implementation of cache adapters has been reorganized by moving trait-based logic into dedicated files within the Traits directory. This includes AbstractAdapterTrait for core adapter behavior, FilesystemCommonTrait and FilesystemTrait for filesystem storage, MongoDbTrait for MongoDB, PdoTrait for database storage, and ProxyTrait for lazy-loading proxies. Additionally, Redis-specific proxy traits (Redis63ProxyTrait, RedisCluster62ProxyTrait, RedisCluster63ProxyTrait) and proxy classes (RedisClusterNodeProxy, RedisClusterProxy) have been introduced to support newer phpredis versions and lazy connection initialization.
Traits · high confidence
Behavioural changes
2 commits (0 fixes) modifying CacheWarmer
A change to existing behaviour in CacheWarmer — 2 commits, 2 files: “\[Cache\]\[FrameworkBundle\]\[Routing\]\[Serializer\]\[Translation\]\[TwigBundle\]\[Validator\] Preserve legacy types of moved services”; “\[FrameworkBundle\]\[Cache\]\[Serializer\]\[Validator\] Move the cache warmers into their own components”.
CacheWarmer · medium confidence · unverified
2 commits (0 fixes) modifying Command
A change to existing behaviour in Command — 2 commits, 5 files: “\[FrameworkBundle\]\[Cache\]\[Routing\]\[Translation\] Move the classes CacheBundle, RouterBundle and TranslationBundle wire into their own components”; “\[Console\] Add command invocation formatting and migrate command examples”.
Command · medium confidence · unverified
Cache compiler passes moved to the Cache component
The dependency-injection compiler passes responsible for managing cache pools—specifically CacheCollectorPass, CachePoolClearerPass, CachePoolPass, and CachePoolPrunerPass—have been relocated from the FrameworkBundle to the Cache component. This change centralizes the logic for wiring cache services, handling pool clearing, pruning, and data collection within the Cache component itself, rather than relying on the FrameworkBundle to orchestrate these container modifications.
DependencyInjection · high confidence
Cache component restructured with new CacheBundle and PSR-16/PSR-6 interoperability
The Cache component is now a standalone bundle (CacheBundle) that provides its own configuration, commands (such as cache:pool:clear and cache:pool:prune), and cache warmers, moving these responsibilities out of FrameworkBundle. It introduces Psr16Cache to wrap PSR-6 pools as PSR-16 SimpleCache interfaces, adds PruneableInterface for manual stale cache pruning, and implements ResettableInterface to allow resetting a pool's local state. The component also adds MongoDB adapters, supports namespace-based invalidation, and updates its test configuration to use PHPUnit 13.1 with stricter deprecation and risk handling.
(repo-wide) · high confidence
Cache exceptions now implement PSR-16 SimpleCache interfaces
The cache exception classes (CacheException, InvalidArgumentException, LogicException, and BadMethodCallException) have been updated to implement the PSR-16 SimpleCache interfaces in addition to their existing PSR-6 implementations. This allows these exceptions to be caught by code expecting PSR-16 compliant errors, ensuring broader compatibility when using PSR-16 adapters alongside PSR-6 cache backends.
Exception · high confidence
New cache service definitions and console commands in FrameworkBundle
The FrameworkBundle now includes dedicated configuration files for the Cache component, registering service definitions for various cache adapters (such as filesystem, Redis, Memcached, and Doctrine DBAL) and exposing cache management console commands (clear, prune, delete, list, invalidate tags). This change moves cache wiring into the FrameworkBundle's Resources/config directory, making these services and commands available by default when the bundle is used.
Resources · high confidence
Fixes
1 commit (1 fix) fixing Internal, Messenger
A fix in Internal, Messenger — 1 commit (1 fix), 4 files: “\[Cache\]\[FrameworkBundle\] Fix async recomputation for chains and decorated pools”.
Internal · medium confidence · unverified
Test coverage
Added comprehensive test suite for Cache Adapter components; Added test fixtures for cache adapter testing; Added tests for Cache Bundle dependency injection and commands; Added tests for Cache Marshaller implementations; Added tests for Cache Traits; Added tests for Cache/Messenger early expiration integration; Added tests for CacheBundle, CacheItem, LockRegistry, and PSR-16 adapters; Added tests for CacheDataCollector.
Dependencies
Symfony Cache component requires PHP 8.4.1 and upgrades to PSR-6/16 v2/v3
The Symfony Cache component has been updated to require PHP 8.4.1 or higher, dropping support for older PHP versions. It now provides implementations for PSR-6 (psr/cache) versions 2.0 and 3.0, as well as PSR-16 (psr/simple-cache) versions 1.0, 2.0, and 3.0. The package also introduces new dependencies on symfony/cache-contracts ^3.8, symfony/service-contracts ^2.5\|^3, and symfony/var-exporter ^8.1, while adding conflicts for ext-redis \<6.1, ext-relay \<0.12.1, and symfony/dependency-injection \<8.1 to ensure compatibility with the new requirements.
(dependencies) · high confidence
Written by cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
How this codebase got here
Score
- CAI 50.6 → 49.4 (-1.2)
- Rubric changed (rubric-2026.11.2 → rubric-2026.11.4) — scores are not directly comparable.
Lenses
- Code Health 57.4 → 56.6 (-0.8)
- Architecture 85.4 → 69.4 (-16.0)
- Maturity 40.4 → 40.6 (+0.2)
- Readiness 46.8 → 46.8 (0.0)
- Security 100.0 → 100.0 (0.0)
Resolved (3)
- Duplicated block (2–5 lines × 4) (Adapter/AbstractAdapter.php)
- Near-duplicate member pair (32 shared lines) (Adapter/AbstractAdapter.php)
- Off-boarding risk: anonymized user #1
New (19)
- ChainAdapter.__construct (cognitive 17) (Adapter/ChainAdapter.php)
- Circular dependency (CacheBundle.php)
- EarlyExpirationMessage.create (cognitive 18) (Messenger/EarlyExpirationMessage.php)
- Edited copies of one member (4 members, 9+ corresponding lines) (Adapter/TraceableAdapter.php)
- Edited copy of a member (10 corresponding lines) (Adapter/TagAwareAdapter.php)
- Edited copy of a member (12 corresponding lines) (Traits/PdoTrait.php)
- Edited copy of a member (15 corresponding lines) (Adapter/PdoTagAwareAdapter.php)
- Edited copy of a member (38 corresponding lines) (Adapter/FilesystemTagAwareAdapter.php)
- Edited copy of a member (5 corresponding lines) (Adapter/TraceableAdapter.php)
- Edited copy of a member (75 corresponding lines) (Adapter/RedisTagAwareAdapter.php)
- Edited copy of a member (8 corresponding lines) (Adapter/PhpArrayAdapter.php)
- Edited copy of a member (9 corresponding lines) (Adapter/DoctrineDbalAdapter.php)
- Hotspot: Adapter/AbstractTagAwareAdapter.php (Adapter/AbstractTagAwareAdapter.php)
- Hotspot: Adapter/MemcachedAdapter.php (Adapter/MemcachedAdapter.php)
- MethodTooLong: MemcachedAdapter.createConnection (Adapter/MemcachedAdapter.php)
- Near-duplicate member pair (32 shared lines) (Adapter/AbstractAdapter.php)
- Off-boarding risk: anonymized user #1
- Orphaned file (Adapter/CouchbaseCollectionAdapter.php)
- Orphaned file (Adapter/NullAdapter.php)
Changes since last survey
- 29 commits — 19 feature/other, 10 fixes
By area
- (repo) — 17 commits
- Tests/Adapter — 4 commits
- (root) — 2 commits
- Adapter/MemcachedAdapter.php — 2 commits
- Adapter/AbstractTagAwareAdapter.php — 1 commit
- Tests/Messenger — 1 commit
- Tests/Traits — 1 commit
- Traits/RedisClusterNodeProxy.php — 1 commit
Notable commits
- fix: [Cache] Fix ChainAdapter losing the expiry of items propagated from FilesystemAdapter
- fix: [Cache] Fix Memcached DSN options misreading booleans, integers and constant names
- fix: [Cache] Fix dead phpredis and predis links in comments
- fix: [Cache] Fix items without expiry read back as expiring in 2090
- fix: [Cache][FrameworkBundle] Fix async recomputation for chains and decorated pools
- fix: [Cache][HttpFoundation][Lock] Fix memcached items with a TTL ending after 2038 expiring at once
- fix: [Cache][Messenger] Fix Redis connections and Messenger transports misreading integer and boolean options
- fix: [Cache][Messenger] Fix Redis connections and the Beanstalkd transport reading invalid option values as 0 or false
- fix: bug #67850 [Cache] Declare the temporary tag set as KEYS[2] in RedisTagAwareAdapter::doInvalidate() (srebb)
- fix: bug #68090 [Cache] Fix items without expiry read back as expiring in 2090 (skybleak333)
- change: Declare bundle options that resolve at compile time
- change: Merge branch '5.4' into 6.4
- change: Merge branch '6.4' into 7.4
- change: Merge branch '6.4' into 7.4
- change: Merge branch '6.4' into 7.4
- change: Merge branch '6.4' into 7.4
- change: Merge branch '7.4' into 8.1
- change: Merge branch '7.4' into 8.1
- change: Merge branch '7.4' into 8.1
- change: Merge branch '7.4' into 8.1
- …and 9 more
Written by cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
Survey your own repository
symfony/cache was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.
About this page
- The score is its most recent published measurement, taken on 17 November 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
- Measured at commit 4b39b80418abe8e3ed18adf4b28655bf862b57a7 — the exact code this score is about.
- Scored under rubric-2026.11.4 — the same rubric and the same method as every other entry in this index.
- Measured by Canine Code Analyzer (cca.canine.dev) using cca measure-2026.11.85+preprod-eba6548ac50f.