Cache, driving speed and responsiveness of your reports to the max
September 9, 2017Let make small party to welcome a new important package, Cache, the missing piece to perfect your report with speed and responsiveness.
Most of us has known about caching and its usefulness. The need of it is even more intense in reporting. As you may understand, a large report may pull a large data various sources and process them into desired result. That is heavy task which takes much time and resources. Because of that, we may experience the slow report load everytime we reload the report. Furthermore, if the report is delivered to many readers, the system will have to work very hard to re-generate same result to many people. It causes the waste in computing resources.
Cache package solves above problem for KoolReport. To add caching ability to a report is very simple.
class MyReport extends \koolreport\KoolReport
{
use \koolreport\cache\FileCache;
function cacheSettings()
{
return array(
"ttl"=>5*60,// Cache result in 5 minutes
);
}
...
}
In above code, if the report has been run in 5 minutes, result will be saved and used again without bothering loading data from database and processed them again. The first load of report may be slow because it need to produce result but the second will be very, very fast. KoolReport is smart enough to recognize the change in report's parameters. If there are changes in parameters, it will refresh results.
Currently Cache package support three caching methods FileCache
, ApcCache
and MemCache
. The FileCache uses file system to store result temporarily. This is the easiest method and requires lowest installation. While the ApcCache use well-known PHP APC Caching to store result. The same with MemCache which utilize the MemCached library. Although they require supported php module at back, the ApcCache and MemCache are stronger solutions.
The Regular License of Cache package only cost three coffee cups $9. The Extended License is $27. The price is low compared to the benefits it brings. Your report speed and responsiveness will be improved very much. Not forget to mention, Cache package is also a part of KoolReport Pro. if you have license of KoolReport Pro, you have the Cache package installed.
Thank you very much!
<3 koolreport team