CacheKeyResolver

abstract class CacheKeyResolver : CacheResolver

A CacheResolver that resolves objects and list of objects and fallbacks to the default resolver for scalar fields. It is intended to simplify the usage of CacheResolver when no special handling is needed for scalar fields.

Override cacheKeyForField to compute a cache key for a field of composite type. Override listOfCacheKeysForField to compute a list of cache keys for a field of 'list-of-composite' type.

For simplicity, this only handles one level of list. Implement CacheResolver if you need arbitrary nested lists of objects.

Constructors

Link copied to clipboard
fun CacheKeyResolver()

Functions

Link copied to clipboard
abstract fun cacheKeyForField(field: CompiledField, variables: Executable.Variables): CacheKey?

Return the computed the cache key for a composite field.

Link copied to clipboard
open fun listOfCacheKeysForField(field: CompiledField, variables: Executable.Variables): List<CacheKey?>?

For a field that contains a list of objects, listOfCacheKeysForField returns a list of CacheKeys where each CacheKey identifies an object.

Link copied to clipboard
override fun resolveField(    field: CompiledField,     variables: Executable.Variables,     parent: Map<String, @JvmSuppressWildcards Any?>,     parentId: String): Any?

Resolves a field from the cache. Called when reading from the cache, usually before a network request.