Skip to content

A PSR6 compatible cache pool for profiling cache access, hits and misses.

License

Notifications You must be signed in to change notification settings

Corollarium/PSR6-ProfileCachePool

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 

Repository files navigation

PSR6-ProfileCachePool

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);

About

A PSR6 compatible cache pool for profiling cache access, hits and misses.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages