corollarium / psr6-profilecachepool
A PSR-6 compatible cache pool for profiling cache access, hits and misses.
v1.0.3
2016-09-27 20:25 UTC
Requires
- php: ^5.5 || ^7.0
- psr/cache: ^1.0
Requires (Dev)
- phpunit/phpunit: ^4.0 || ^5.1
Provides
- psr/cache-implementation: ^1.0
This package is auto-updated.
Last update: 2024-09-10 04:25:13 UTC
README
A PSR6 compatible cache pool for profiling cache access, hits and misses. Developed by Corollarium.
Composer
composer require corollarium/psr6-profilecachepool
How to use it
$pool = new \Cache\Wrapper\ProfileCachePool(new MyRealAdapterPool()); // use normally $pool->getItem('foo'); // print cute statistics in the end $pool->reportHTML();
You get something like:
Cache Profile Summary: accessed=>100 / missed=>39 / deleted=>12 / cleaned=>0 / saved=>15 /
Aggregating results
Using multiple cache adapters? It's easy to get the aggregated results.
$pool1 = new \Cache\Wrapper\ProfileCachePool(new MyRealAdapterPool()); $pool2 = new \Cache\Wrapper\ProfileCachePool(new MyOtherAdapterPool()); // use normally $pool1->getItem('foo'); $pool2->getItem('bar'); // merge statistics from several pools together $mergedStatistics = \Cache\Wrapper\ProfileCachePool::mergeProfileSummaries([$pool1, $pool2]); // print cute statistics in the end \Cache\Wrapper\ProfileCachePool::summaryHTML($mergedStatistics);