# symfony/cache

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/symfony-cache).**

4,164 stars · 64 forks · PHP · MIT

## Links

- GitHub: https://github.com/symfony/cache
- Homepage: https://symfony.com/cache
- awesome-repositories: https://awesome-repositories.com/repository/symfony-cache.md

## Topics

`caching` `component` `php` `psr6` `symfony` `symfony-component`

## Description

This is a PHP library providing standardized interfaces for caching data through the PSR-6 and PSR-16 specifications. It functions as a cache pool manager and distributed cache adapter, allowing applications to organize key-value pairs into logical repositories and namespaces.

The project includes a dedicated cache stampede prevention tool that protects systems from CPU spikes during value expiration. This is achieved through locking mechanisms for concurrent requests and probabilistic early expiration.

The library supports object serialization with optional encryption and compression to translate complex data into storable formats. It provides a multi-backend storage abstraction layer, enabling data persistence across memory, filesystems, and distributed databases. Other capabilities include callback-based cache retrieval and key-based namespacing for data segregation.

## Tags

### Programming Languages & Runtimes

- [Caching Interfaces](https://awesome-repositories.com/f/programming-languages-runtimes/php-standard-interface-implementations/caching-interfaces.md) — Provides a full implementation of standardized PHP-FIG caching interfaces (PSR-6 and PSR-16) for library interoperability.
- [PSR-16 Implementations](https://awesome-repositories.com/f/programming-languages-runtimes/php-standard-interface-implementations/psr-16-implementations.md) — Implements the PSR-16 Simple Cache standard for lightweight key-value storage in PHP applications.
- [PSR Standard Implementations](https://awesome-repositories.com/f/programming-languages-runtimes/psr-standard-implementations.md) — Provides a comprehensive implementation of PHP Standard Recommendations (PSR) for caching data interoperability.
- [Object Serialization](https://awesome-repositories.com/f/programming-languages-runtimes/object-serialization.md) — Translates complex PHP objects into storable formats with support for optional encryption and compression.

### Data & Databases

- [Distributed Caching](https://awesome-repositories.com/f/data-databases/distributed-caching.md) — Manages shared state across multiple servers using adapters for distributed databases and filesystems.
- [Cache Pool Organization](https://awesome-repositories.com/f/data-databases/key-value-stores/cache-key-management/cache-pool-organization.md) — Organizes cached key-value pairs into logical repositories and namespaces to provide a structured data storage system.
- [Multi-Backend Storage Management](https://awesome-repositories.com/f/data-databases/multi-backend-storage-management.md) — Implements a unified API to coordinate and manage cached data across diverse storage engines like memory, filesystems, and distributed databases. ([source](https://symfony.com/doc/current/components/cache.html))
- [Cache Pool Management](https://awesome-repositories.com/f/data-databases/performance-caching-systems/cache-pool-management.md) — Provides a system to organize cached information into logical repositories of key-value pairs. ([source](https://symfony.com/doc/current/components/cache.html))
- [Storage Backend Adapters](https://awesome-repositories.com/f/data-databases/storage-backend-adapters.md) — Provides standardized interfaces to swap between different cache storage backends like memory, filesystems, and distributed databases.
- [Cache Avalanche Prevention](https://awesome-repositories.com/f/data-databases/cache-avalanche-prevention.md) — Prevents systemic collapse and CPU spikes by protecting backend databases from mass simultaneous cache expiration. ([source](https://symfony.com/doc/current/components/cache.html))
- [Stampede Mitigation](https://awesome-repositories.com/f/data-databases/concurrent-write-optimizations/concurrent-caches/stampede-mitigation.md) — Mitigates cache stampedes by coordinating concurrent requests during cache misses to prevent redundant backend load.
- [Stampede Protection](https://awesome-repositories.com/f/data-databases/data-governance-modeling/data-management-governance/data-lifecycle-retention/data-lifecycle-management/key-expiration-policies/access-link-expiration/content-expiration-policies/stampede-protection.md) — Protects high-traffic systems from CPU spikes during cache expiration using locking and probabilistic early expiration.
- [Cache](https://awesome-repositories.com/f/data-databases/data-serialization-formats/data-formats/object-serializers/cache.md) — Provides tools to translate complex object states into storable formats with optional encryption and compression for efficient caching. ([source](https://symfony.com/doc/current/components/cache.html))
- [Callback-Based Retrieval](https://awesome-repositories.com/f/data-databases/key-value-stores/cache-key-management/cache-value-retrievals/callback-based-retrieval.md) — Retrieves a cached item by key or executes a callback to compute and store the value if it is missing. ([source](https://symfony.com/doc/current/components/cache.html))
- [Probabilistic Early Expiration](https://awesome-repositories.com/f/data-databases/metadata-caching/cache-expiration-management/probabilistic-early-expiration.md) — Avoids cache stampedes by randomly triggering value recomputation before the actual expiration time based on a probability formula.
- [Cache Namespaces](https://awesome-repositories.com/f/data-databases/schema-namespacing/cache-namespaces.md) — Implements logical grouping of cache entries using key prefixes to isolate data and manage bulk invalidations.

### Software Engineering & Architecture

- [Application Performance Optimization](https://awesome-repositories.com/f/software-engineering-architecture/performance-reliability/performance-optimization/application-performance-tuning/application-performance-optimization.md) — Reduces system load and response times by caching the results of expensive computations in fast-access storage.
- [Serialization Pipelines](https://awesome-repositories.com/f/software-engineering-architecture/serialization-pipelines.md) — Ships a modular serialization pipeline to transform complex objects into storable strings with optional encryption and compression.

### Operating Systems & Systems Programming

- [Cache Miss Locking](https://awesome-repositories.com/f/operating-systems-systems-programming/process-synchronization-locks/concurrent-lock-managers/cache-miss-locking.md) — Prevents multiple processes from recomputing the same expired value by locking concurrent requests during the cache miss period.
