Problem/Motivation
I needed a way to exclude paths from being cached if there is more than a arbitrary number of parameters.
My use case is a search_api view with a lot of facets. I needed the main ones to be cached but not all combinations
For example something like /my-view?f[0]=type:xxxx needed to be cached
But not /my-view?f[0]=type:xxxx&f[1]subtype:yyyy
Proposed resolution
The "Exclude cache for page variation with query parameters" field now accept path in this format :
/<path>|<num>
If the number of query parameters of <path> is above <num> then <path> is not cached.
Paths without |<num> are treated as |0 which is the current behavior
Also added this explanation to the field's description :
You may optionally add "|x" after a path to exclude the page only if the number of query parameters is greater than x. Example: "/search|2". Without "|x", the default behavior is "|0".
Notes
My example is a facet one but it also applies on classic view parameters.
This doesn't take into account the pager parameter
Patch attached, please review
| Comment | File | Size | Author |
|---|---|---|---|
| option-max-parameters-exclude.patch | 2.71 KB | paulguy |
Comments
Comment #2
paulguy commentedComment #3
paulguy commentedComment #4
paulguy commented