Module bus.cache

Annotation Interface CacheKey


@Documented @Retention(RUNTIME) @Target(PARAMETER) public @interface CacheKey
缓存键注解

用于标记方法参数作为缓存键的一部分。可以指定参数的特定部分或字段作为键的组成部分。

Since:
Java 17+
Author:
Kimi Liu
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    使用多模型(value has `# i ` index)方法返回Collection field 指示与此参数相关的 Collection 实体字段中的哪个
    使用参数的一部分作为缓存的关键部分
  • Element Details

    • value

      String value
      使用参数的一部分作为缓存的关键部分

      可以使用SpEL表达式指定参数的特定部分作为键的组成部分

      Returns:
      SpEL表达式,用于指定参数的哪部分作为键
      Default:
      ""
    • field

      String field
      使用多模型(value has `# i ` index)方法返回Collection field 指示与此参数相关的 Collection 实体字段中的哪个

      当方法返回Collection类型时,指定Collection中对象的哪个字段作为键的组成部分

      Returns:
      字段名称,用于指定Collection中对象的哪个字段作为键
      Default:
      ""