|
View:
New views
3 Messages
—
Rating Filter:
Alert me
|
|
|
Zend_Loader_PluginLoader example code suggestionHi,
Is this the right place to suggest a change to Example 28.6 in the docs? <http://framework.zend.com/manual/en/zend.loader.pluginloader.html#zend.loader.pluginloader.performance.example> The code is currently: $classFileIncCache = APPLICATION_PATH . '/../data/pluginLoaderCache.php'; if (file_exists($classFileIncCache)) { include_once $classFileIncCache; } Zend_Loader_PluginLoader::setIncludeFileCache($classFileIncCache); But I believe the following would be better, as the file needs to both exist and be writable for the setIncludeFileCache line to work. $classFileIncCache = APPLICATION_PATH . '/../data/pluginLoaderCache.php'; if (is_writable($classFileIncCache)) { include_once $classFileIncCache; Zend_Loader_PluginLoader::setIncludeFileCache($classFileIncCache); } Thanks, John |
|
|
Re: Zend_Loader_PluginLoader example code suggestion-- John Lamb <john@...> wrote
(on Thursday, 26 March 2009, 01:56 PM +0000): > Is this the right place to suggest a change to Example 28.6 in the docs? > <http://framework.zend.com/manual/en/zend.loader.pluginloader.html#zend.loader.pluginloader.performance.example> > > The code is currently: > $classFileIncCache = APPLICATION_PATH . '/../data/pluginLoaderCache.php'; > if (file_exists($classFileIncCache)) { > include_once $classFileIncCache; > } > Zend_Loader_PluginLoader::setIncludeFileCache($classFileIncCache); > > > But I believe the following would be better, as the file needs to both > exist and be writable for the setIncludeFileCache line to work. > > $classFileIncCache = APPLICATION_PATH . '/../data/pluginLoaderCache.php'; > if (is_writable($classFileIncCache)) { > include_once $classFileIncCache; > Zend_Loader_PluginLoader::setIncludeFileCache($classFileIncCache); > } To include it, you only need to know that the file exists. The line to setIncludeFileCache() can actually be omitted once you've populated the cache well. I certainly wouldn't make is_writable() a requirement for loading from it. That said... I should probably put an is_writable() check into _appendCache() and throw an exception if it's not. -- Matthew Weier O'Phinney Software Architect | matthew@... Zend Framework | http://framework.zend.com/ |
|
|
Re: Zend_Loader_PluginLoader example code suggestionOn Thu, Mar 26, 2009 at 11:16:51AM -0400, Matthew Weier O'Phinney wrote:
> To include it, you only need to know that the file exists. The line to > setIncludeFileCache() can actually be omitted once you've populated the > cache well. I certainly wouldn't make is_writable() a requirement for > loading from it. > > That said... I should probably put an is_writable() check into > _appendCache() and throw an exception if it's not. > Could the section which mentions disabling the cache be updated to explain this? How about something like this, instead of the bit which starts "During Development": Once the cache has been populated you no longer need to update it using the setIncludeFileCache call, so you may wish to disable these updates. By continuing to include the cache file you will still get all of the performance benefits. One option is to use a configuration key for determining whether or not the plugin loader should update the cache. You can then opt to only update the cache when your code has changed. |
| Free embeddable forum powered by Nabble | Forum Help |