EvanDotPro/EdpSuperluminal

Idea: Split Zend\Mvc\Application::init and Zend\Mvc\Application::run

ThaDafinser opened this issue · 2 comments

I'm having a lot of actions in my application and i would like to cache only the init() part of the application.

I think it would be cool, if there is an option for this.

use Zend\Mvc\MvcEvent;

//current event
$events->attach('Zend\Mvc\Application', MvcEvent::EVENT_FINISH, array($this, 'cache'));

//only init event
$events->attach('Zend\Mvc\Application', MvcEvent::EVENT_BOOTSTRAP, array($this, 'cache'));

What do you think @EvanDotPro

An example (the class count)

Before run: 575 classes in my app (353 in SkeletonApp)
After run: 670 classes in my app (389 in SkeletonApp)

// Run the application!
$app = Zend\Mvc\Application::init(require 'config/application.config.php');

$classes = array_merge(get_declared_interfaces(), get_declared_classes());
echo count($classes).' | ';

$app->run();

$classes = array_merge(get_declared_interfaces(), get_declared_classes());
echo count($classes);
exit();