@Target(value=METHOD) @Inherited @Retention(value=RUNTIME) public @interface Cache
| 限定符和类型 | 可选元素和说明 |
|---|---|
int[] |
argumentIndexNumbers
参数序号数组,会取对应的参数值的字符串组成自定义缓存key
(1)isCustomCacheKey值为true时,该字段配置才有效
(2)没有配置值时不会取对应的参数值的字符串组成自定义缓存key,即对调用该接口的所有请求都生效
|
int |
blockTime
限制时间,即多少时间内快速返回失败,默认值:1,默认时间单位:TimeUnit.SECONDS
|
TimeUnit |
blockTimeUnit
blockTime的时间单位,默认时间单位:TimeUnit.SECONDS
|
Class<?> |
customCacheKeyCreaterClass
自定义key的创建类,返回的值作为自定义缓存key的一部分,
配置的Class必须实现CustomCacheKeyCreater接口,否则配置无效,忽略该配置
有指定该类的话会忽略argumentIndexNumbers配置,若创建的key为null则该配置无效,将忽略该配置
|
boolean |
fastBackFail
是否快速失败
|
String |
fastBackFailMessage
快速失败返回的消息,默认:快速返回失败
|
FastBackEnum |
fastBackType |
boolean |
isCustomCacheKey
是否自定义key,只针对快速返回和快速失败有效,默认值:false
|
public abstract TimeUnit blockTimeUnit
public abstract FastBackEnum fastBackType
public abstract String fastBackFailMessage
public abstract boolean isCustomCacheKey
public abstract int[] argumentIndexNumbers
public abstract Class<?> customCacheKeyCreaterClass
Copyright © 2018. All rights reserved.