Lesti_Fpc
Lesti_Fpc copied to clipboard
Key-Parameter improvements
In trying to achieve 100% cached status (especially for categories), these are some improvements I needed to hack in:
First, after dispatching the event 'fpc_helper_collect_params', you need to ksort the $params. Otherwise it will generate different keys for essentially the same content, only because the array order is different.
Second, in categories, it seems there are two possible keys each for sort-key, sort-direction, and pagination-length. Which one is set depends on if it has been set prior (and is now stored in session), or is activated right now. These generate many duplicate keys that lead to the same content. I ended up overwriting the session over to the uri keys:
$map = Array(
'uri_dir' => 'session_sort_direction',
'uri_order' => 'session_sort_order',
'uri_limit' => 'session_limit_page'
);
foreach ($map as $uri => $session) {
if (isset( $params[$session] )) {
if (!isset($additionalParams[$uri])) {
$params[$uri] = $params[$session];
}
unset( $params[$session] );
}
}
I realize this may differ on other magento installations but something like this could be configurable in the backend.
Hello @Ineluki pretty good improvements. Would you like to create a PullRequest for the first thing? The second thing has the problem like you said, it may differ on other magento installations. But I will keep that in mind.