cache / util
PSR-6 和 PSR-16 缓存工具
0.2.0
2022-01-12 20:25 UTC
Requires
- php: >=7.4
- psr/cache: ^1.0 || ^2.0
Requires (Dev)
- cache/array-adapter: ^1.0
- phpunit/phpunit: ^7.5.20 || ^9.5.10
This package is auto-updated.
Last update: 2024-09-17 14:42:29 UTC
README
这是一个PSR-16和PSR-6缓存标准的工具集合。
安装
composer require cache/util
使用
use function Cache\Util\SimpleCache\remember; $cache = new SimpleCache(); // some simple cache interface // if the result exists at the key, it'll return from cache, else it'll execute the callback and store in cache and return. $res = remember($cache, 'key', 3600, function() { return someExpensiveOperation(); });