This is the code from application figuration:
'name'=>'Yii Playground on Nicolas Machine',
// preloading 'log' component
'preload'=>array('log', 'dbManager', 'uiSettings', 'lc'),
// autoloading model and component classes
My question is what is "preload" exactly. Does it mean yii read the class file(e.g.: dbManager.php) and store the content in server memory? How to determine if a component should preload?
April 8, 2011, 7:54am
Without preloading an application component, it will only be instantiatet on first access. This saves ressources, because in some requests a component isn’t touched at all, so it’s never created.
Usually the only component you want to preload is
log. This is done to make sure, that the log router can do it’s job and output something on every request, even if the log component isn’t accessed at all.
April 15, 2011, 2:39pm
Thanks a lot! Instantiate is a logic in OOP. I guess if it’s instantiated, then it must have went through the CPU and somewhere in the server memory.
June 27, 2011, 2:56pm
Do I need to preload Core Application Components? such as db, request, session… see the core component lists
I am sure I am going to use them in every web page.
June 28, 2011, 7:07am
No, they are loaded automatically.
September 2, 2014, 9:08pm
is there something like "postload" ?