cache / util
PSR-6 and PSR-16 Caching Utilities
1.0.4
2026-08-20 02:14 UTC
Requires
- php: ^8.2
- psr/simple-cache: ^2.0 || ^3.0
Requires (Dev)
- cache/array-adapter: ^2.0 || ^3.0
- phpunit/phpunit: ^11.5
README
This package provides small utilities for PSR cache implementations.
Installation
composer require cache/util:^1.0
Usage
The remember() helper reads a PSR-16 value or creates and stores it when the cache misses.
use function Cache\Util\SimpleCache\remember; $result = remember( $cache, 'report.monthly', 3600, static fn () => buildMonthlyReport(), );
Here, $cache implements Psr\SimpleCache\CacheInterface. The callback runs only when no cached value is available.
Contributing
Send pull requests to the main repository. Report issues on the GitHub issue tracker.