Annotation Type CachePut


  • @Target({METHOD,TYPE})
    @Retention(RUNTIME)
    @Inherited
    @Documented
    @CacheConfig
    @CacheAnnotation
    @Repeatable(PutOperations.class)
    public @interface CachePut

    An annotation that can be applied at the type or method level to indicate that the annotated operation should cause the return value to be cached within the given cache name. Unlike Cacheable this annotation will never skip the original invocation.

    Since:
    1.0
    • Element Detail

      • value

        @AliasFor(member="cacheNames")
        java.lang.String[] value
        Returns:
        The cache names
        Default:
        {}
      • parameters

        java.lang.String[] parameters
        Limit the automatic CacheKeyGenerator to the given parameter names. Mutually exclusive with keyGenerator()
        Returns:
        The parameter names that make up the key.
        Default:
        {}
      • async

        boolean async

        Whether the CachePut operation should be performed asynchronously and not block the returning value

        The value if async impacts behaviour in the following ways:

        • For blocking return types when the value is false the method will not return until the value has been written and any cache write errors will be propagated back to the client.
        • For blocking return types when the value is true the method will return prior to cache writes occurring and errors will be logged via the AsyncCacheErrorHandler.
        • When the return type is a CompletableFuture and the value is false the future will not complete until the CachePut operation is complete.
        • When the return type is a CompletableFuture and the value is true the future will complete prior to any CachePut operations completing and the operations will be executing asynchronously with errors logged by AsyncCacheErrorHandler.
        Returns:
        True if cache writes should be done asynchronously
        Default:
        false