cache / doctrine-adapter
使用 Doctrine 实现的 PSR-6 缓存。此实现支持标签
1.2.0
2022-01-15 15:47 UTC
Requires
- php: >=7.4
- cache/adapter-common: ^1.0
- doctrine/cache: ^1.6
- psr/cache: ^1.0 || ^2.0
- psr/simple-cache: ^1.0
Requires (Dev)
- cache/integration-tests: ^0.17
- mockery/mockery: ^1.0
- phpunit/phpunit: ^7.5.20 || ^9.5.10
Suggests
- ext-apc: Allows for caching with Apc
- ext-memcache: Allows for caching with Memcache
- ext-memcached: Allows for caching with Memcached
- ext-redis: Allows for caching with Redis
Provides
README
这是一个使用 Doctrine 缓存的 PSR-6 缓存实现。它是 PHP Cache 组织的一部分。有关标签和分层支持等功能的详细信息,请参阅 www.php-cache.com 上的共享文档。
这是一个 PSR-6 到 Doctrine 的桥梁。如果您对 Doctrine 到 PSR-6 的桥梁感兴趣,应该查看 PSR-6 Doctrine Bridge。
安装
composer require cache/doctrine-adapter
使用
use Doctrine\Common\Cache\MemcachedCache; use Cache\Adapter\Doctrine\DoctrineCachePool; $memcached = new \Memcached(); $memcached->addServer('localhost', 11211); // Create a instance of Doctrine's MemcachedCache $doctrineCache = new MemcachedCache(); $doctrineCache->setMemcached($memcached); // Wrap Doctrine's cache with the PSR-6 adapter $pool = new DoctrineCachePool($doctrineCache);