Class DefaultCacheKeyGenerator

  • All Implemented Interfaces:
    CacheKeyGenerator
    Direct Known Subclasses:
    KotlinSuspendFunCacheKeyGenerator

    @Introspected
    public class DefaultCacheKeyGenerator
    extends java.lang.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
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.Object generateKey​(io.micronaut.core.annotation.AnnotationMetadata annotationMetadata, java.lang.Object... params)
      Generate a key for the given annotated element and parameters.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • DefaultCacheKeyGenerator

        public DefaultCacheKeyGenerator()
    • Method Detail

      • generateKey

        public java.lang.Object generateKey​(io.micronaut.core.annotation.AnnotationMetadata annotationMetadata,
                                            java.lang.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.