DianaIonita / serverless-api-gateway-caching

A plugin for the Serverless framework which helps with configuring caching for API Gateway endpoints.
ISC License
136 stars 35 forks source link

Support for `cacheKeyParameters` per QueryStringParameter #59

Closed gligorkot closed 5 years ago

gligorkot commented 5 years ago

Love this plugin! It is super valuable and very quick to set up.

One thing that would be great to add is support for queryStringParameters in the cacheKeyParameters property.

Thank you!

DianaIonita commented 5 years ago

Thanks @gligorkot!

You should already be able to specify query string parameters as cache keys, like this:

# Responses are cached based on the 'breed' query string parameter
get-cats-by-breed:
  handler: rest_api/cat/get/handler.handle
  events:
    - http:
        path: /cats
        method: get
        caching:
          enabled: true
          cacheKeyParameters:
            - name: request.querystring.breed
gligorkot commented 5 years ago

@DianaIonita oh cool! I tried query and querystringparameter, but not just querystring hehehe.

Perhaps adding this to the Readme would help then?

Edit: I just saw it in the Readme 🤦‍♂ how could I have missed that???

Thanks for pointing me to it.

DianaIonita commented 5 years ago

No worries - a bit hard to spot to be fair, cache key parameters probably need a section of their own.