private static function getCacheParams($actionContext, $cacheSettings, $parameterName, $value = null) {
        $actionName = $actionContext->getActionName();
        $params = array();

        if ($parameterName != 'varyByCustom') {
            ksort($value);

            // action level
            if (!empty($cacheSettings[$actionName][$parameterName])) {
                if ($cacheSettings[$actionName][$parameterName] == '*') {
                    // all parameters
                    $params = $value;
                    $allParameters = true;
                }
                else {
                    // specified parameters
                    $varyByParam = array_map('trim', explode(';', $cacheSettings[$actionName][$parameterName]));
                    sort($varyByParam);
    
                    foreach ($varyByParam as $param) {
                        $params[$param] = $param . '=' . (isset($value[$param]) ? $value[$param] : '');
                    }
                }
            }
    
            // controller level
            if (!isset($allParameters) && !empty($cacheSettings['.'][$parameterName])) {
                if ($cacheSettings['.'][$parameterName] == '*') {
                    // all parameters
                    $params = $value;
                }
                else {
                    // specified parameters
                    $varyByParam = array_map('trim', explode(';', $cacheSettings['.'][$parameterName]));
                    sort($varyByParam);
    
                    foreach ($varyByParam as $param) {
                        if (empty($params[$param])) {
                            $params[$param] = $param . '=' . (isset($value[$param]) ? $value[$param] : '');
                        }
                    }
                }
            }
        }
        else {
            if (!empty($cacheSettings[$actionName][$parameterName]) && is_callable($cacheSettings[$actionName][$parameterName])) {
                $params[] = '0=' . $cacheSettings[$actionName][$parameterName]($actionContext);
            }

            if (empty($params[0]) && !empty($cacheSettings['.'][$parameterName]) && is_callable($cacheSettings['.'][$parameterName])) {
                $params[] = '0=' . $cacheSettings['.'][$parameterName]($actionContext);
            }
        }

        return $params;
    }