This package provides small utilities for PSR cache implementations.
composer require cache/util:^1.0The 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.
Send pull requests to the main repository. Report issues on the GitHub issue tracker.