This plugin was developed to increase the performance of high traffic websites. On my experiments, it increased the performance drastically, mainly for pageviews. But, it adds some complexity to deploy or update the contents and in most of cases it will change the architecture of your website.
Search for "statefull" or use the plugin's code: eBussola.Statefull
Choose a structure to use and follow the instructions
Don't need the AJAX Page Container
Use the AJAX Page Container
Use the AJAX Page Container
It is used to centralize the ajax framework requests. Because now you are running your website on another infrastructure you need to keep your plugins working.
-
Create a page with the route /ajax (You can customise this route)
-
Add every component used on all your pages with exact the same configuration.
-
Drop the "AJAX Page Container component" to your footer's layout
You can customise the url of ajax page container on the settings. Remember to change the route on the page too.
Only use this feature if your site use the flash tag markup
Because of your site is now statefull, you will need to check if there is any message to be delivered to user. This component do this job.
Make sure you are using the {% flash %} tag.
By default this feature is disabled, just active this feature on the settings page.
In the settings you can adjust the delay to close the alert or set the wrapper element where the alert will be placed.
You can call the function window.ebussolaStatefullCheckMessages whenever you want to check for new messages.
/*
|--------------------------------------------------------------------------
| eBussola.Statefull Plugin
|--------------------------------------------------------------------------
|
| Statefull check if an cache file exists and loads it, preventing to start the whole framework.
|
*/
$request = \Symfony\Component\HttpFoundation\Request::createFromGlobals();
if ($request->isMethod('GET')) {
$cachePath = __DIR__ . '/storage/statefull-cache';
$pathInfo = $request->getPathInfo();
$blacklist = file_exists($cachePath . '/index-blacklist.config') ?
file_get_contents($cachePath . '/index-blacklist.config') : null;
$paramBlacklist = file_exists($cachePath . '/param-blacklist.config') ?
json_decode(file_get_contents($cachePath . '/param-blacklist.config'), true) : [];
$paramBlacklistFunctionFile = $cachePath . '/param-blacklist-function.php';
if (file_exists($paramBlacklistFunctionFile)) {
include $paramBlacklistFunctionFile;
if (preg_match('/^(?!\/backend)(?!\/combine)' . $blacklist . '/i', $pathInfo) === 1 && !isParamBlacklisted($paramBlacklist)) {
$file = $cachePath . $pathInfo . '.html';
if (file_exists($file)) {
echo file_get_contents($file);
exit(0);
}
}
}
}
The Command statefull:cache:refresh MUST be executed by the root!