PHPackages                             bedrockstreaming/stale-cache-bundle - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Caching](/categories/caching)
4. /
5. bedrockstreaming/stale-cache-bundle

ActiveSymfony-bundle[Caching](/categories/caching)

bedrockstreaming/stale-cache-bundle
===================================

Add a stale mode into Symfony cache

v2.0.0(3y ago)34.2k↓33.3%proprietaryPHPPHP ^8.0

Since Aug 10Pushed 3y ago29 watchersCompare

[ Source](https://github.com/BedrockStreaming/StaleCacheBundle)[ Packagist](https://packagist.org/packages/bedrockstreaming/stale-cache-bundle)[ RSS](/packages/bedrockstreaming-stale-cache-bundle/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (5)Dependencies (16)Versions (6)Used By (0)

Bedrock Stale cache Bundle
==========================

[](#bedrock-stale-cache-bundle)

Introduction
------------

[](#introduction)

This bundle aims to provide a stale cache feature to the `symfony/cache` component. Basically, it does the following steps:

1. extending the lifetime of cache items with a "stale period"
2. during the stale period, if a cache item is fetched, try to regenerate it
3. if the regeneration fails with a specifically marked error, give back the initially cached value

Usage
-----

[](#usage)

### Configuration

[](#configuration)

First, you should configure each stale cache service:

```
bedrock_stale_cache:
    decorated_cache_pools:
        stale_cache_service_id:                    # Desired id for this new stale cache instance
            cache_pool: cache_pool_id              # Cache pool on top of which stale cache will be used
            max_stale: 3600                        # Stale period duration, in seconds
            enable_debug_logs: true                # Optional (defaults to false), produce a bunch of debug logs
```

It will declare a `@stale_cache_service_id`, that you can use as an injected dependency. The stale service will implement `Symfony\Contracts\Cache\CacheInterface`, so you'll need to use the `get` method to fetch cache items. You can use `Symfony\Contracts\Cache\TagAwareCacheInterface` if you need tagging capabilities.

It's not compatible with the old `Symfony\Component\Cache\Adapter\AdapterInterface`.

### Allow stale cache for some errors

[](#allow-stale-cache-for-some-errors)

To use stale cache, you'll have to implement `Bedrock\StaleCacheBundle\Exception\UnavailableResourceException` on a custom, thrown error. The method `allowStaleCacheUsage` can be used for some custom logic, or you can hard code a `return true`.

### Events

[](#events)

A `Bedrock\StaleCacheBundle\Event\StaleCacheUsage` event is sent on stale cache usage. It is strongly advised to log it, with the associated error.

### Logs

[](#logs)

Debug logs can be enabled to ensure correct stale cache usage. It should not be enabled in a production environment since it can cause performance issue.

Contribute
----------

[](#contribute)

You can execute `make quality test` to execute quality checks and tests. There is also a few make targets that can help you check this bundle is correctly supported on every Symfony versions

- `make composer-install-sf4`
- `make composer-install-sf5`
- `make composer-install-sf6`

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity23

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 95.7% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~10 days

Total

5

Last Release

1335d ago

Major Versions

v0.2.0 → v1.0.02022-09-21

v1.0.0 → v2.0.02022-09-21

PHP version history (2 changes)v0.1.0PHP ^7.4 || ^8.0

v2.0.0PHP ^8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/2069361?v=4)[Patrick](/maintainers/Bedrock)[@Bedrock](https://github.com/Bedrock)

---

Top Contributors

[![shavounet](https://avatars.githubusercontent.com/u/2323369?v=4)](https://github.com/shavounet "shavounet (22 commits)")[![fferriere](https://avatars.githubusercontent.com/u/2240265?v=4)](https://github.com/fferriere "fferriere (1 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Rector

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/bedrockstreaming-stale-cache-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/bedrockstreaming-stale-cache-bundle/health.svg)](https://phpackages.com/packages/bedrockstreaming-stale-cache-bundle)
```

###  Alternatives

[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M651](/packages/sylius-sylius)[simplesamlphp/simplesamlphp

A PHP implementation of a SAML 2.0 service provider and identity provider.

1.1k12.4M193](/packages/simplesamlphp-simplesamlphp)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

595.2M386](/packages/shopware-core)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M152](/packages/sulu-sulu)[contao/core-bundle

Contao Open Source CMS

1231.6M2.4k](/packages/contao-core-bundle)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
