注释类型 Cached


@Documented @Retention(RUNTIME) @Target(METHOD) public @interface Cached
作者:
huangli
  • 可选元素概要

    可选元素
    修饰符和类型
    可选元素
    说明
    If you want to use multi backend cache system, you can setup multi "cache area" in configuration, this attribute specifies the name of the "cache area" you want to use.
    boolean
    Specify whether a null value should be cached.
    Type of the Cache instance.
    Expression script used for conditioning the method caching, the cache is not used when evaluation result is false.
    boolean
    Specify whether the method caching is enabled.
    int
    The expire time.
    Specify the key by expression script, optional.
    Specify the key convertor.
    int
    Use to specify the local cache expire time when cacheType=CacheType.BOTH, use "expire" if absent.
    int
    Specify max elements in local memory when cacheType is CacheType.LOCAL or CacheType.BOTH.
    The name of this Cache instance, optional.
    Expression script used for conditioning the method cache updating, the cache updating action is vetoed when the evaluation result is false.
    Specify the serialization policy of remote cache when cacheType is CacheType.REMOTE or CacheType.BOTH.
    boolean
    if cacheType is CacheType.BOTH and the remote cache supports broadcast (or BroadcastManager bean exists), invalidate local cache of all process after put/remove operation.
    Specify the time unit of expire.
  • 元素详细资料

    • area

      String area
      If you want to use multi backend cache system, you can setup multi "cache area" in configuration, this attribute specifies the name of the "cache area" you want to use.
      返回:
      the name of cache area
      默认值:
      "default"
    • name

      String name
      The name of this Cache instance, optional. If you do not specify, JetCache will auto generate one. The name is used to display statistics information and as part of key prefix when using a remote cache. Do not assign same name to different @Cached annotation which with same area.
      返回:
      the name of the cache
      默认值:
      "$$undefined$$"
    • enabled

      boolean enabled
      Specify whether the method caching is enabled. If set to false, you can enable it in thread context using CacheContext.enableCache(Supplier<T> callback)
      返回:
      if the method cache is enabled
      默认值:
      true
    • timeUnit

      TimeUnit timeUnit
      Specify the time unit of expire.
      返回:
      the time unit of expire time
      默认值:
      SECONDS
    • expire

      int expire
      The expire time. Use global config if the attribute value is absent, and if the global config is not defined either, use infinity instead.
      返回:
      the expire time
      默认值:
      -2147483648
    • localExpire

      int localExpire
      Use to specify the local cache expire time when cacheType=CacheType.BOTH, use "expire" if absent.
      返回:
      the local cache expire time
      默认值:
      -2147483648
    • cacheType

      CacheType cacheType
      Type of the Cache instance. May be CacheType.REMOTE, CacheType.LOCAL, CacheType.BOTH. Create a two level cache (local+remote) when value is CacheType.BOTH.
      返回:
      cache type of the method cache
      默认值:
      REMOTE
    • syncLocal

      boolean syncLocal
      if cacheType is CacheType.BOTH and the remote cache supports broadcast (or BroadcastManager bean exists), invalidate local cache of all process after put/remove operation.
      返回:
      should sync local cache
      默认值:
      false
    • localLimit

      int localLimit
      Specify max elements in local memory when cacheType is CacheType.LOCAL or CacheType.BOTH. Use global config if the attribute value is absent, and if the global config is not defined either, use CacheConsts.DEFAULT_LOCAL_LIMIT instead.
      返回:
      local maximal elements of the LOCAL/BOTH cache
      默认值:
      -2147483648
    • serialPolicy

      String serialPolicy
      Specify the serialization policy of remote cache when cacheType is CacheType.REMOTE or CacheType.BOTH. The JetCache build-in serialPolicy are SerialPolicy.JAVA or SerialPolicy.KRYO. Use global config if the attribute value is absent, and if the global config is not defined either, use SerialPolicy.JAVA instead.
      返回:
      the serialization policy name of cache value
      默认值:
      "$$undefined$$"
    • keyConvertor

      String keyConvertor
      Specify the key convertor. Used to convert the complex key object. The JetCache build-in keyConvertor are KeyConvertor.FASTJSON or KeyConvertor.NONE. NONE indicate do not convert, FASTJSON will use fastjson to convert key object to a string. Use global config if the attribute value is absent.
      返回:
      convertor name of cache key
      默认值:
      "$$undefined$$"
    • key

      String key
      Specify the key by expression script, optional. If not specified, use all parameters of the target method and keyConvertor to generate one.
      返回:
      an expression script which specifies key
      默认值:
      "$$undefined$$"
    • cacheNullValue

      boolean cacheNullValue
      Specify whether a null value should be cached.
      返回:
      whether a null value should be cached
      默认值:
      false
    • condition

      String condition
      Expression script used for conditioning the method caching, the cache is not used when evaluation result is false. Evaluation occurs before real method invocation.
      默认值:
      "$$undefined$$"
    • postCondition

      String postCondition
      Expression script used for conditioning the method cache updating, the cache updating action is vetoed when the evaluation result is false. Evaluation occurs after real method invocation so we can refer result in script.
      默认值:
      "$$undefined$$"