roave / doctrine-simplecache
Doctrine Cache adapter for PSR-16 Simple Cache
Installs: 329 994
Dependents: 9
Suggesters: 0
Security: 0
Stars: 55
Watchers: 13
Forks: 11
Open Issues: 1
Requires
- php: ^7.4 || ~8.0.0
- doctrine/cache: ^1.7
- psr/simple-cache: ^1.0
Requires (Dev)
- cache/integration-tests: dev-master
- cache/tag-interop: dev-master
- infection/infection: ^0.20.0
- phpunit/phpunit: ^8.4
- symfony/console: ^4.3
- symfony/phpunit-bridge: ^4.4@dev
Provides
README
PSR-16 SimpleCache implementation that accepts a Doctrine Cache and adapts it for the PSR-16 standards.
Installation
This will install doctrine/cache
if not already installed.
$ composer require roave/doctrine-simplecache
Usage
Create your Doctrine Cache the usual way and inject it into SimpleCacheAdapter
, for example:
<?php namespace App; use Psr\Container\ContainerInterface; use Psr\SimpleCache\CacheInterface as PsrCacheInterface; use Roave\DoctrineSimpleCache\SimpleCacheAdapter; use Doctrine\Common\Cache\RedisCache; final class MyCacheFactory { public function __invoke(ContainerInterface $container) : PsrCacheInterface { return new SimpleCacheAdapter(new RedisCache()); } }
Upgrade Guide
BC Breaks in 2.0
- Support for
MultiOperationCache
added, includes support fordeleteMultiple
in Doctrine 1.7 breaks:CacheException
static constructorsfromNonMultiGetCache
andfromNonMultiPutCache
have been replaced withfromNonMultiOperationCache
.SimpleCacheAdapter
now requires an adapter implementingMultiOperationCache
, and no longer specifically requires a cache implementingMultiGetCache
orMultiPutCache
explicitly.