Skip to content
CAI
Software that uses CAICheck a score

symfony/cache

54.7

Adequate · 19 September 2026

15.1k

lines of production code

PHP

primary language

1

measurement over time

CAI band scale
CAI lens gauges

What this system is

This system is a comprehensive caching component that provides a unified interface for storing and retrieving data across various backends, including Redis, Memcached, MongoDB, and filesystems. It supports advanced features such as tag-based invalidation, stampede protection, and asynchronous recomputation via message queues, while offering extensible serialization with encryption and compression options. The component also includes detailed profiling tools and granular command-line utilities for managing cache pools and monitoring performance.

How it got here

2016 — Cache component major refactoring

7 changes.

The Symfony Cache component underwent a major structural overhaul, introducing a new CacheBundle, expanded adapter support with tag-aware capabilities, and stampede protection via LockRegistry. This period focused on aligning the component with modern PHP standards and PSR-6/PSR-16 specifications, while significantly raising minimum version requirements and adding comprehensive test coverage for the new infrastructure.

2017–2018 — Cache component refactoring and extensibility

6 changes.

This period focused on modernizing the Cache component by introducing a pluggable marshaller system with support for compression and encryption, and refactoring internal traits for better PSR-6/PSR-16 compliance. The work also involved centralizing dependency injection logic and compiler passes within the Cache component itself, while adding comprehensive profiling capabilities and extensive test coverage for the new features.

2020–2026 — Cache component modularization and tooling

8 changes.

This period focused on enhancing the Cache component's modularity and operational tooling by introducing async early expiration via Messenger and relocating cache warmer classes. It also expanded console command capabilities for granular pool management and added comprehensive test coverage for collectors, traits, and proxy classes.

Features

Add support for Relay extension versions 0.20 through 0.50

The Relay cache adapter now supports the Relay PHP extension versions 0.20.0 through 0.50.0. New trait files (Relay20Trait through Relay50Trait and their Cluster counterparts) expose version-specific methods such as \jsonStrAppend\, \hotkeys\, \increx\, \lmovem\, \fcall\, and \himport\, ensuring compatibility with the evolving Relay API surface.

Traits/Relay · high confidence

Cache integration with Messenger for async value recomputation

The Cache component now integrates with the Messenger component to allow computing cached values in a background worker. New classes in the \Symfony\\Component\\Cache\\Messenger\ namespace—\EarlyExpirationMessage\, \EarlyExpirationDispatcher\, and \EarlyExpirationHandler\—enable offloading the regeneration of stale cache items to a message bus, reducing latency for the initial request by deferring the expensive computation.

Messenger · high confidence

Introduces extensible cache marshaller system with encryption and compression support

The Cache component now uses a pluggable MarshallerInterface instead of hard-coded serialization logic. The new DefaultMarshaller allows users to explicitly opt-in to igbinary (skipping it by default on PHP 7.4+ and requiring version 3.1.6+ when enabled) and can be configured to throw a ValueError on serialization failures in debug mode. Additionally, TagAwareMarshaller provides a compact binary format for tag-aware cache entries to optimize storage, DeflateMarshaller adds gzip-style compression via zlib, and SodiumMarshaller enables encryption using libsodium with support for rotating decryption keys.

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 usage within the application. This collector tracks individual cache calls (such as get, save, and delete), calculates detailed statistics including hits, misses, and execution time per adapter, and exposes this data for display in the web profiler. It implements LateDataCollectorInterface to ensure accurate data collection after the request lifecycle is complete.

DataCollector · high confidence

New cache pool management commands available

The Cache component now provides dedicated console commands for granular cache pool management. Users can list available pools (\cache:pool:list\), clear specific or all pools with exclusions (\cache:pool:clear\), delete individual cache items (\cache:pool:delete\), invalidate cache tags across pools (\cache:pool:invalidate-tags\), and prune expired items from pruneable pools (\cache:pool:prune\). These commands replace the previous monolithic cache clearing approach, offering more precise control over cache operations.

Command · high confidence

Behavioural changes

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 bundle, adapters, and stampede protection

The Cache component has been significantly reorganized and expanded. A new \CacheBundle\ now centralizes configuration and service wiring previously handled by \FrameworkBundle\, introducing dedicated console commands for pool management (clear, delete, invalidate-tags, list, prune). New cache adapters have been added, including \MongoDbAdapter\, \MongoDbTagAwareAdapter\, and \PdoTagAwareAdapter\, while \CouchbaseBucketAdapter\ is removed in favor of \CouchbaseCollectionAdapter\. Stampede protection is now handled by a new \LockRegistry\ class that uses file locking to prevent concurrent cache misses. The component also introduces \PruneableInterface\ for manual stale cache pruning, \ResettableInterface\ for clearing local pool state, and \Psr16Cache\ to wrap PSR-6 pools as PSR-16. Configuration now supports DSN-based provider selection, and the default namespace algorithm changed from SHA256 to XXH128.

(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

Cache traits refactored to support PSR-6/PSR-16 and modern PHP

The Traits directory has been restructured to provide the internal implementation backbone for the Cache component's adapters. This change introduces new traits such as AbstractAdapterTrait, FilesystemTrait, PdoTrait, and MongoDbTrait, which centralize core caching logic like item fetching, saving, and clearing. It also adds ProxyTrait for lazy-loading and reset capabilities, and ContractsTrait to integrate with the new symfony/contracts abstractions. Additionally, Redis-specific traits (Redis63ProxyTrait, RedisCluster62ProxyTrait, etc.) have been added to expose newer phpredis methods conditionally based on the extension version, ensuring the cache adapters remain compatible with the latest Redis client features.

Traits · high confidence

Cache warmer classes moved to the Cache component

The \AbstractPhpFileCacheWarmer\ and \CachePoolClearerCacheWarmer\ classes have been relocated from the HttpKernel component to the Cache component. This structural change updates their namespace to \Symfony\\Component\\Cache\\CacheWarmer\ and adjusts their dependencies, such as using \Psr6CacheClearer\ from HttpKernel for pool clearing, to reflect the new modular organization.

CacheWarmer · high confidence

Major overhaul of cache adapters with new interfaces and tag-aware implementations

The cache adapter layer has been significantly refactored to introduce new base interfaces and abstract classes, including AdapterInterface, AbstractTagAwareAdapter, and specific implementations like ChainAdapter, CouchbaseCollectionAdapter, DoctrineDbalAdapter, FilesystemAdapter, FilesystemTagAwareAdapter, MemcachedAdapter, and MongoDb adapters. This change brings support for tag-based cache invalidation across multiple backends, improves performance through optimized serialization and pruning, and aligns with modern PHP standards and Doctrine DBAL 4.x requirements.

Adapter · 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

Test coverage

Added comprehensive test suite for Cache adapter infrastructure; Added test coverage for CacheBundle, CacheItem, LockRegistry, and PSR-16 adapters; 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/Messenger early expiration integration; Added tests for CacheDataCollector; Added tests for Redis and Relay proxy traits and connection handling.

Dependencies

Symfony Cache component major version upgrade

The Symfony Cache component has been upgraded to a new major version, significantly raising the minimum PHP requirement to 8.4.1 and updating PSR-6/PSR-16 support to versions 2.0 and 3.0. This release introduces new dependencies on Symfony Var-Exporter (8.1), Service Contracts, and Clock Contracts, while removing legacy support for Doctrine Cache and older DBAL versions. It also enforces stricter requirements for Redis extensions (ext-redis \>= 6.1, ext-relay \>= 0.12.1) and adds support for Predis 2.0 and Doctrine DBAL 4.3 in development.

(dependencies) · high confidence

Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

How this codebase got here

Baseline

  • First survey — no prior run to compare against. CAI 55.

Lenses

  • Code Health 83
  • Architecture 80
  • Maturity 47
  • Readiness 42
  • Security 100

Changes since last survey

  • 300 commits — 250 feature/other, 50 fixes

By area

  • (repo) — 191 commits
  • (root) — 26 commits
  • Tests/Adapter — 20 commits
  • Traits/Relay — 12 commits
  • Tests/Traits — 7 commits
  • Adapter/DoctrineDbalAdapter.php — 5 commits
  • Traits/RedisTrait.php — 5 commits
  • Adapter/ArrayAdapter.php — 4 commits
  • DependencyInjection/CachePoolPass.php — 4 commits
  • Tests/DependencyInjection — 4 commits
  • Adapter/AbstractTagAwareAdapter.php — 3 commits
  • Adapter/PdoAdapter.php — 3 commits
  • Adapter/TagAwareAdapter.php — 3 commits
  • Adapter/PhpArrayAdapter.php — 2 commits
  • Tests/Psr16CacheTest.php — 2 commits
  • .github/PULL_REQUEST_TEMPLATE.md — 1 commit
  • Adapter/ChainAdapter.php — 1 commit
  • Adapter/CouchbaseCollectionAdapter.php — 1 commit
  • Adapter/ProxyAdapter.php — 1 commit
  • Marshaller/SodiumMarshaller.php — 1 commit

Notable commits

  • fix: PHP CS Fixer: fix minor detected issues
  • fix: CS fixes
  • fix: CS fixes - native_function_invocation & static_lambda
  • fix: Fix merge
  • fix: Fix merge
  • fix: Fix post-merge cleanups for #64389
  • fix: Fix up
  • fix: More CS fixes
  • fix: Revert "Give the Redis test probes an explicit connect timeout"
  • fix: Revert "bug #62852 [Cache] Fix DSN auth not passed to clusters in RedisTrait (wikando-ck)"
  • fix: [Cache] Fix "Class Relay\Relay not found" for RedisCluster/RedisArray with tcp_keepalive
  • fix: [Cache] Fix ChainAdapter ignoring item expiry when propagating to earlier adapters
  • fix: [Cache] Fix DSN auth not passed to Redis/RedisCluster/Relay in RedisTrait
  • fix: [Cache] Fix DSN auth not passed to clusters in RedisTrait
  • fix: [Cache] Fix Predis ignoring the "auth" parameter set in the DSN or in the options
  • fix: [Cache] Fix Psr16Cache::getMultiple() returning ValueWrapper with TagAwareAdapter
  • fix: [Cache] Fix Psr16Cache::getMultiple() returning wrapper values when using TTL
  • fix: [Cache] Fix authenticating to the master when using Redis Sentinel
  • fix: [Cache] Fix cache/integration-tests dep
  • fix: [Cache] Fix calling the callback wrapper for ChainAdapter
  • …and 280 more

Written by watchdog.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 19 September 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
  • Measured at commit defd4e542c9c1117c35246b1b3006025d55235bd — the exact code this score is about.
  • Scored under rubric-2026.09.15 — the same rubric and the same method as every other entry in this index.
  • Measured by watchdog.canine.dev using codehealth-analyzer preprod-13a154b7f5d1.