try apc caching for views

This commit is contained in:
zebardy 2019-11-21 18:51:04 +00:00
parent 632870c364
commit 4f37e4a390

View File

@ -63,15 +63,16 @@ $appContainer = new \Slim\Container([
'view' => function($container) 'view' => function($container)
{ {
$view_time_start = microtime(true); $view_time_start = microtime(true);
$view = new \Slim\Views\Blade(__DIR__ . '/views', GROCY_DATAPATH . '/viewcache'); #$view = new \Slim\Views\Blade(__DIR__ . '/views', GROCY_DATAPATH . '/viewcache');
fwrite($fp, "!!!App - view load time : " . round((microtime(true) - $view_time_start),6) . "\n"); fwrite($fp, "!!!App - view load time : " . round((microtime(true) - $view_time_start),6) . "\n");
return $view;
if (!apcu_exists("views")) if (!apcu_exists("views"))
{ {
apcu_store("views", new \Slim\Views\Blade(__DIR__ . '/views', GROCY_DATAPATH . '/viewcache')); apcu_store("views", new \Slim\Views\Blade(__DIR__ . '/views', GROCY_DATAPATH . '/viewcache'));
} }
return apcu_fetch("views"); $view = apcu_fetch("views");
fwrite($fp, "!!!App - view load time : " . round((microtime(true) - $view_time_start),6) . "\n");
return $view;
}, },
'LoginControllerInstance' => function($container) 'LoginControllerInstance' => function($container)
{ {