PHPackages                             toflar/psr6-symfony-http-cache-store - 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. toflar/psr6-symfony-http-cache-store

ActiveLibrary[Caching](/categories/caching)

toflar/psr6-symfony-http-cache-store
====================================

An alternative store implementation for Symfony's HttpCache reverse proxy that supports auto-pruning of expired entries and cache invalidation by tags.

4.3.0(5mo ago)574.2M↓26%69MITPHPPHP ^8.1CI passing

Since Dec 1Pushed 5mo ago4 watchersCompare

[ Source](https://github.com/Toflar/psr6-symfony-http-cache-store)[ Packagist](https://packagist.org/packages/toflar/psr6-symfony-http-cache-store)[ RSS](/packages/toflar-psr6-symfony-http-cache-store/feed)WikiDiscussions 4.x Synced 1mo ago

READMEChangelog (10)Dependencies (6)Versions (27)Used By (9)

PSR-6 compatible Symfony HttpCache Store
========================================

[](#psr-6-compatible-symfony-httpcache-store)

Supported branches
------------------

[](#supported-branches)

- For PHP ^7.2 and Symfony &lt;6, use version 3.x
- For PHP ^8.0 and Symfony &gt;6, use version 4.x

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

[](#introduction)

Symfony's `HttpCache` store implementation is rather old and was developed when there were no separate components for locking and caching yet. Moreover, expired cache entries are never pruned and thus causes your cache directory to continue to grow forever until you delete it manually.

Along the way, I needed support for cache invalidation based on tags which was pretty easy to implement thanks to the Symfony Cache component.

This bundle thus provides an alternative `StoreInterface` implementation that…

- …instead of re-implementing locking and caching mechanisms again, uses the well tested Symfony Cache and Lock components, both with the local filesystem adapters by default.
- …thanks to the `TagAwareAdapterInterface` of the Cache component, supports tag based cache invalidation.
- …thanks to the `PrunableInterface` of the Cache component, supports auto-pruning of expired entries on the filesystem trying to prevent flooding the filesystem.
- …allows you to use a different PSR-6 cache adapters as well as a different lock adapter than the local filesystem ones. However, **be careful about choosing the right adapters**, see warning below.
- …supports `BinaryFileResponse` instances.

Installation
------------

[](#installation)

```
$ composer require toflar/psr6-symfony-http-cache-store

```

Configuration
-------------

[](#configuration)

For the Symfony 4/Flex structure, you need to adjust your `index.php` like this:

```
