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.
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
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.