public class CommonKeyGenerator extends Object implements org.springframework.cache.interceptor.KeyGenerator
1.使用方法,把此方法注入spring, bean的name设置为 CommonKeyGenerator.GENERATOR_NAME 2. 缓存方法的Cacheable/CacheEvict/CachePut注解的keyGenerator属性设置为CommonKeyGenerator.GENERATOR_NAME
| 限定符和类型 | 字段和说明 |
|---|---|
static String |
GENERATOR_NAME
当前bean注册到容器的时候,使用的名字 和本参数保持一致,方便在缓存注解中使用此参数
|
| 构造器和说明 |
|---|
CommonKeyGenerator() |
public String getPrefix()
public void setPrefix(String prefix)
public Object generate(Object target, Method method, Object... params)
generate 在接口中 org.springframework.cache.interceptor.KeyGeneratorpublic static boolean isSimpleType(Class<?> clazz)
Copyright © 2022. All rights reserved.