Class DefaultCacheKeyGenerator

java.lang.Object
io.micronaut.cache.interceptor.DefaultCacheKeyGenerator
All Implemented Interfaces:
CacheKeyGenerator
Direct Known Subclasses:
KotlinSuspendFunCacheKeyGenerator

@Introspected public class DefaultCacheKeyGenerator extends Object implements CacheKeyGenerator

A default implementation of the CacheKeyGenerator interface that uses the parameters of the method only.

This implementation is appropriate for most common cases but note that collisions can occur for classes that use the same cache and have overlapping signatures as the default implementation does not use the method itself when generating the key

Since:
1.0
Author:
Graeme Rocher
  • Constructor Details

    • DefaultCacheKeyGenerator

      public DefaultCacheKeyGenerator()
  • Method Details

    • generateKey

      public Object generateKey(io.micronaut.core.annotation.AnnotationMetadata annotationMetadata, Object... params)
      Description copied from interface: CacheKeyGenerator
      Generate a key for the given annotated element and parameters.
      Specified by:
      generateKey in interface CacheKeyGenerator
      Parameters:
      annotationMetadata - The annotated metadata
      params - The parameters
      Returns:
      The generated key. Never null.