TypePolicyCacheKeyGenerator
class TypePolicyCacheKeyGenerator(typePolicies: Map<String, TypePolicy>, keyScope: CacheKey.Scope = CacheKey.Scope.TYPE) : CacheKeyGenerator
A CacheKeyGenerator that uses the @typePolicy directive to compute the cache key.
This uses the key fields of the field's concrete type (found in __typename).
Parameters
typePolicies
the type policies as declared in the schema via @typePolicy.
keyScope
the scope of the generated cache keys. Use CacheKey.Scope.TYPE to namespace the keys by the concrete type name, or CacheKey.Scope.SERVICE if the ids are unique across the whole service.
Functions
Link copied to clipboard
open override fun cacheKeyForObject(obj: Map<String, Any?>, context: CacheKeyGeneratorContext): CacheKey?
Returns a CacheKey for the given object or null if the object doesn't have an id