cache / doctrine-adapter
A PSR-6 cache implementation using Doctrine. This implementation supports tags
Requires
- php: ^8.2
- cache/adapter-common: ^3.0
- doctrine/cache: ^2.2
- psr/cache: ^3.0
- psr/simple-cache: ^2.0 || ^3.0
Requires (Dev)
- cache/integration-tests: ^1.0@dev
- mockery/mockery: ^1.6
- phpunit/phpunit: ^11.5
Suggests
- ext-memcache: Allows for caching with Memcache
- ext-memcached: Allows for caching with Memcached
- ext-redis: Allows for caching with Redis
Provides
- psr/cache-implementation: 3.0
- psr/simple-cache-implementation: 2.0 || 3.0
README
This package adapts a legacy Doctrine\Common\Cache\Cache implementation to PSR-6 and PSR-16.
Use the PSR-6 Doctrine bridge when a legacy library needs Doctrine Cache and your application already has a PSR-6 pool.
Installation
composer require cache/doctrine-adapter:^3.0
Usage
Pass an existing Doctrine Cache implementation to the pool:
use Cache\Adapter\Doctrine\DoctrineCachePool; use Doctrine\Common\Cache\Cache; function createPool(Cache $doctrineCache): DoctrineCachePool { return new DoctrineCachePool($doctrineCache); }
Doctrine Cache 2.x provides the legacy interfaces but no storage drivers. Your application must provide the concrete implementation.
Upgrading to version 3
Version 3 stores a generation snapshot with each tagged item and a separate marker for each tag. Version 2 workers cannot safely share this format.
Stop or drain all workers, clear the Doctrine cache, and then deploy version 3. Follow the same sequence before a rollback.
Contributing
Send pull requests to the main repository. Report issues on the GitHub issue tracker.