0

I have several API paths set up in a test API Gateway setup with a simple 'api' stage. I am using AWS Lambda and wish to cache the results of the lambda call.

There are three test paths (no authentication)

/a/{thing} (GET Caching turned on in stage)

/b/{thing} (GET Caching turned off in stage)

/c/{thing} (GET Caching turned off in stage)

They all map to the same lambda function. The lambda function returns the current time and the value of {thing}.

If I request /a/0000 through /a/1000 I get back the same result for a function that ran for thing=0000.

If I request /b/0000 through /b/1000 (or /c/) I get back uncached results.

thing is selected as 'cache' in resources /a/{thing}. Nothing else is set 'cache'.

It is my understanding that selecting 'cache' next to a path element, query element, or header would construct a cache key - possibly a multi-key cache key hash. That would be ideal!

Ideally /a/0000 and /a/1234 would return a cached version keyed to the {thing} value.

What did I do wrong or misread or step over? Am I hitting a bug when it comes to AWS Lambda? Is caching keyed to authorization - these URLs are public and unauthenticated. I'm just using curl to request these and nothing is being cached on the client side of course.

Honestly. I've also tried using a query argument as the only cache key and let the cache flush and waited 30 minutes to try try try again. Still not giving the results I would expect.

whardier
  • 665
  • 5
  • 8
  • Hi. Any news on this? Did you manage? Now I have the same requirement where I need to exclude one (or more in the future) path from caching. – Sufi Apr 16 '21 at 12:38

1 Answers1

0

Pro Tip:

You still have to deploy from resources to stage when you set up cache keys. This makes sense of course but it would be good if the management console showed more about the method parameters than it does.

I am using Chalice.. which is why I wasn't deploying in the normal fashion.

whardier
  • 665
  • 5
  • 8