normalizedCache

@JvmName(name = "configureApolloClientBuilder")
fun ApolloClient.Builder.normalizedCache(normalizedCacheFactory: NormalizedCacheFactory, cacheKeyGenerator: CacheKeyGenerator = TypePolicyCacheKeyGenerator, cacheResolver: CacheResolver = FieldPolicyCacheResolver, writeToCacheAsynchronously: Boolean = false): ApolloClient.Builder

Configures an ApolloClient with a normalized cache.

Parameters

normalizedCacheFactory

a factory that creates a com.apollographql.apollo3.cache.normalized.api.NormalizedCache. It will only be called once. The reason this is a factory is to enforce creating the cache from a non-main thread. For native the thread where the cache is created will also be isolated so that the cache can be mutated.

cacheResolver

a CacheResolver to customize normalization

writeToCacheAsynchronously

set to true to write to the cache after the response has been emitted. This allows to display results faster