aws / aws-appsync-community

The AWS AppSync community
https://aws.amazon.com/appsync
Apache License 2.0
506 stars 32 forks source link

[Feature Request] Per-function caching #332

Open jbschooley opened 10 months ago

jbschooley commented 10 months ago

I would love to see the ability to cache the result of an individual function in addition to an entire resolver.

For example, think of an app where you have 50 different endpoints. All of them do different things, but they all use the user's settings to determine what to do, like the user's chosen language or whether they have admin permissions. Hitting the data source for these same settings on every single query puts extra load on the database and adds latency.

Instead, you’d configure a function to grab these settings with ctx.identity as the cache key with a timeout of say 10 min. Then evict it on any request that changes a users settings or permission level.

jbschooley commented 4 months ago

Is this a feature that could be added? It would be incredibly useful for pretty much any resolver that uses db-based identity to determine what to return