GraphQL Cache is Caching Fields Separately for Record Types with No Optional Values #6652
Labels
module/graphql
Issues related to Ballerina GraphQL module
Team/PCM
Protocol connector packages related issues
Type/Improvement
Description:
Consider the following GraphQL service:
In the above example, the cache size is set to
5
. But this will execute the resource function each time a request arrives because the cache size is exhausted. The reason is that each record field is cached as a separate cache entry, so there will be a total of 10 cache entries (3*3 fields + top-level resource value). Since the cache limit is 5, caches will be evicted and the subsequent responses have to be fetched again.This behaviour can be improved only when the GraphQL resource is returning a record type with no optional fields. For other cases such as record types with optional fields or service types, there's no way to cache at the top level and not cache the sub-fields since the different requests will populate different fields which might cause some field values to become null in the cache.
The text was updated successfully, but these errors were encountered: