-
Notifications
You must be signed in to change notification settings - Fork 583
Closed
Description
Is your feature request related to a problem? Please describe.
I am trying out Yoga as an alternative to Apollo Server 4, and when it comes to response cache plugin the one in Yoga is a more crude version that doesn't have any means to support the following API:
extraCacheKeyDatacalculateCacheKeyshouldReadFromCacheandshouldWriteToCache
Describe the solution you'd like
extraCacheKeyData(requestContext): any- Ability to give a hook for adding anextrakey with value being result of callback, which internally is passed tobuildResponseCacheKey({ ...original, extra })calculateCacheKey(requestContext): string- Ability to alter cache key used for reading and writing to cache, if this is passed useconst key = calculateCacheKey ? ${originalKey}:${calculateCacheKey(requestContext)} : originalKey.shouldReadFromCacheabdshouldWriteToCache- Ability to skip response cache altogether, such as based on header (might not need a code change)*
Describe alternatives you've considered
calculateCacheKeymight be might be more of a@envelop/response-cache-redisconcern, and as such I might have been able to usebuildRedisOperationResultCacheKey, but it is not yieldingrequestContext. Still we might want to split this feature request to that library instead.
*) I thinkshouldReadFromCacheabdshouldWriteToCachecan be combined into simply "skip cache", since we are always using them together and set to the same value. But we might not even need support for these in the plugin itself, as we can just skip adding this plugin altogether instead.
Additional context
N/A
Metadata
Metadata
Assignees
Labels
No labels