Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FEATURE: Add Setting queryParams|cookieParams.respect to invert the control #22

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

sbruggmann
Copy link

added new options cookieParams.respect and queryParams.respect which work the opposite way the options cookieParams.ignore and queryParams.ignore do.

this way we define in the settings which cookies and arguments really matter to our code.
all others don't affect the caching.

especially with tag managers and different tracking we have a lot of changing cookies and arguments which are only meant for the frontend and should never affect the code generation and caching.

we as developers should have the option to just allow known cookies and arguments, and ignore the rest.

…t add cookies and arguments which affect the caching. which makes configuration much easier.
Copy link
Member

@mficzel mficzel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fine by reading, i like this better than solutions via cookie name prefix.

Copy link
Member

@mficzel mficzel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think allowedQueryParams also should only be checked when respectedQueryParams is empty and the respectedQueryParams should become part of the generated identifier.

case (in_array($key, $this->ignoredQueryParams) && empty($this->respectedQueryParams)):
$ignoredQueryParams[$key] = $value;
break;
case (!in_array($key, $this->respectedQueryParams) && empty($this->ignoredQueryParams)):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think a respected queryParameter should be added to $allowedQueryParams[$key] as i would assume this to be part of the cache identity.

That imho would also mean that allowedQueryParams should only be checked when $this->respectedQueryParams is empty.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mficzel How would you configure FullPageCache to not cache a search query in this case?

@mficzel mficzel changed the title inverted cache disabling to cache FEATURE: Add Setting queryParams|cookieParams.respect to invert the control Oct 18, 2023
@lorenzulrich
Copy link

@sbruggmann I really like this change. Have you seen the comment by Martin? Would you be willing to finish this PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants