Skip to content

defineCachedHandler: include/exclude query params #14

Closed

Description

@MickL

Describe the feature

Usecase
Using defineCachedHandler(), this two make two cache entries:

  • GET /products?color=red&lang=de
  • GET /products?color=red&lang=en

But what if the result is the same for all languages and I want to ignore the lang query param?

Also adding random query params could be used to bypass cache by "hackers":

  • GET /products?color=red&a=123

Solution
defineCachedHandler() could have two new options:

  • Include-Array: Watch specific query params but ignore all others, e.g. include: ['color']
  • Exclude-Array: Watch all query params but ignore specific ones, e.g. exclude: ['lang']

Additional information

  • Would you be willing to help implement this feature?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions