注释类型 TTLCachePut


  • @Target({TYPE,METHOD})
    @Retention(RUNTIME)
    @Inherited
    @Documented
    @CachePut(cacheResolver="ttlCacheResolver")
    public @interface TTLCachePut
    @CachePut with TTL
    从以下版本开始:
    1.0.0
    作者:
    Mercy
    • 必需元素概要

      所需元素 
      修饰符和类型 必需的元素 说明
      long expire
      The expire time for cacheable entry
    • 可选元素概要

      可选元素 
      修饰符和类型 可选元素 说明
      java.lang.String[] cacheManagers
      The bean names of the custom CacheManager
      java.lang.String[] cacheNames
      Names of the caches in which method invocation results are stored.
      java.lang.String condition
      Spring Expression Language (SpEL) expression used for making the method caching conditional.
      java.lang.String key
      Spring Expression Language (SpEL) expression for computing the key dynamically.
      java.lang.String keyGenerator
      The bean name of the custom KeyGenerator to use.
      java.util.concurrent.TimeUnit timeUnit
      The timeunit of expire
      java.lang.String unless
      Spring Expression Language (SpEL) expression used to veto method caching.
      java.lang.String[] value
      Alias for cacheNames().
    • 元素详细资料

      • expire

        long expire
        The expire time for cacheable entry
      • value

        @AliasFor(annotation=org.springframework.cache.annotation.CachePut.class)
        java.lang.String[] value
        Alias for cacheNames().
        默认值:
        {}
      • cacheNames

        @AliasFor(annotation=org.springframework.cache.annotation.CachePut.class)
        java.lang.String[] cacheNames
        Names of the caches in which method invocation results are stored.

        Names may be used to determine the target cache (or caches), matching the qualifier value or bean name of a specific bean definition.

        从以下版本开始:
        4.2
        另请参阅:
        value(), CacheConfig.cacheNames()
        默认值:
        {}
      • key

        @AliasFor(annotation=org.springframework.cache.annotation.CachePut.class)
        java.lang.String key
        Spring Expression Language (SpEL) expression for computing the key dynamically.

        Default is "", meaning all method parameters are considered as a key, unless a custom keyGenerator() has been configured.

        The SpEL expression evaluates against a dedicated context that provides the following meta-data:

        • #root.method, #root.target, and #root.caches for references to the method, target object, and affected cache(s) respectively.
        • Shortcuts for the method name (#root.methodName) and target class (#root.targetClass) are also available.
        • Method arguments can be accessed by index. For instance the second argument can be accessed via #root.args[1], #p1 or #a1. Arguments can also be accessed by name if that information is available.
        默认值:
        ""
      • keyGenerator

        @AliasFor(annotation=org.springframework.cache.annotation.CachePut.class)
        java.lang.String keyGenerator
        The bean name of the custom KeyGenerator to use.

        Mutually exclusive with the key() attribute.

        另请参阅:
        CacheConfig.keyGenerator()
        默认值:
        ""
      • cacheManagers

        java.lang.String[] cacheManagers
        The bean names of the custom CacheManager
        默认值:
        {}
      • condition

        @AliasFor(annotation=org.springframework.cache.annotation.CachePut.class)
        java.lang.String condition
        Spring Expression Language (SpEL) expression used for making the method caching conditional. Cache the result if the condition evaluates to true.

        Default is "", meaning the method result is always cached.

        The SpEL expression evaluates against a dedicated context that provides the following meta-data:

        • #root.method, #root.target, and #root.caches for references to the method, target object, and affected cache(s) respectively.
        • Shortcuts for the method name (#root.methodName) and target class (#root.targetClass) are also available.
        • Method arguments can be accessed by index. For instance the second argument can be accessed via #root.args[1], #p1 or #a1. Arguments can also be accessed by name if that information is available.
        默认值:
        ""
      • unless

        @AliasFor(annotation=org.springframework.cache.annotation.CachePut.class)
        java.lang.String unless
        Spring Expression Language (SpEL) expression used to veto method caching. Veto caching the result if the condition evaluates to true.

        Unlike condition(), this expression is evaluated after the method has been called and can therefore refer to the result.

        Default is "", meaning that caching is never vetoed.

        The SpEL expression evaluates against a dedicated context that provides the following meta-data:

        • #result for a reference to the result of the method invocation. For supported wrappers such as Optional, #result refers to the actual object, not the wrapper
        • #root.method, #root.target, and #root.caches for references to the method, target object, and affected cache(s) respectively.
        • Shortcuts for the method name (#root.methodName) and target class (#root.targetClass) are also available.
        • Method arguments can be accessed by index. For instance the second argument can be accessed via #root.args[1], #p1 or #a1. Arguments can also be accessed by name if that information is available.
        从以下版本开始:
        3.2
        默认值:
        ""
      • timeUnit

        java.util.concurrent.TimeUnit timeUnit
        The timeunit of expire
        默认值:
        java.util.concurrent.TimeUnit.MILLISECONDS