cache/psr-6-doctrine-bridge

PSR-6 Doctrine 桥接器

3.2.0 2022-01-15 15:47 UTC

This package is auto-updated.

Last update: 2024-09-17 14:25:27 UTC


README

Gitter Latest Stable Version codecov.io Total Downloads Monthly Downloads Software License

此库提供了一个 Doctrine 与 Cache Pool 之间的 PSR-6 兼容桥接器。该桥接器实现了 Doctrine\Common\Cache\Cache 接口。这对于需要实现 Doctrine\Common\Cache\Cache 但仍然想使用 PSR-6 实现的项目非常有用。

安装

composer require cache/psr-6-doctrine-bridge

用法

use Cache\Bridge\Doctrine\DoctrineCacheBridge;

// Assuming $pool is an instance of \Psr\Cache\CacheItemPoolInterface
$cacheProvider = new DoctrineCacheBridge($pool);

$cacheProvider->contains($key);
$cacheProvider->fetch($key);
$cacheProvider->save($key, $value, $ttl);
$cacheProvider->delete($key);

// Also, if you need it:
$cacheProvider->getPool(); // same as $pool

贡献

欢迎贡献!请向 主仓库 提交拉取请求,或在 问题跟踪器 上报告您发现的问题。