IdCacheKeyGenerator

class IdCacheKeyGenerator(idFields: String = arrayOf("id"), keyScope: CacheKey.Scope = CacheKey.Scope.TYPE) : CacheKeyGenerator

A CacheKeyGenerator that uses the given id fields to compute the cache key. If the id field(s) is/are missing, the object is considered to not have an id.

Parameters

idFields

the possible names of the fields to use as id. The first present one is used.

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.

See also

IdCacheKeyResolver

Constructors

Link copied to clipboard
constructor(vararg idFields: String = arrayOf("id"), keyScope: CacheKey.Scope = CacheKey.Scope.TYPE)

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