I’ve updated Slim Framework 3.0 to 3.5 on my server and I noticed that a new option named routerCacheFile for settings have been added.
So as the documentation says I’ve choosen a valid PHP writable file so I can test it and see how it works. Everything worked fine, the file was filled with the route caching on the first run.
My question is: What benefits does this brings ? The answer can be in the PRO/CON format. I want just to know if this impact somehow in the perfomance since is disabled by default.
Note that I don’t know what this option does, would be appreciated if someone explained to me in a few words this options.
Multiple measurements at once can be achieved by an optional parameter.
Debugger::timer('page-generating');
// some code
Debugger::timer('rss-generating');
// some code
$rssElapsed = Debugger::timer('rss-generating');
$pageElapsed = Debugger::timer('page-generating');
Debugger::timer(); // runs the timer
... // some time consuming operation
echo Debugger::timer(); // elapsed time in seconds
Debugger::timer();
It would seem that this is used only in FastCache. From the point of view of a slim application, does this mean that my ‘workflow’ still requires me to define all my routes but than I simply do a
$router->setCachFile($file)
after defining my routes? Also, where in the application should this be placed? I think router is created in Slim itself, so what’s the proper place to do a setCacheFile() ?