1 Star 0 Fork 953

韵律浮尘/jboot

forked from JbootProjects/jboot 
加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
CacheServiceImpl.java 1.47 KB
一键复制 编辑 原始数据 按行查看 历史
Michael Yang 提交于 2018-05-16 21:19 +08:00 . fixed bugs
package cache;
import io.jboot.aop.annotation.Bean;
import io.jboot.core.cache.annotation.CacheEvict;
import io.jboot.core.cache.annotation.CachePut;
import io.jboot.core.cache.annotation.Cacheable;
import io.jboot.core.cache.annotation.CachesEvict;
@Bean
public class CacheServiceImpl implements CacheService {
@Override
@Cacheable(name = "mycache", key = "#(key)", unless = "key =='zhangsan'")
public String cacheAble(String key) {
System.out.println("cacheAble invoked!!!!");
return key + " from CacheServiceImpl.cacheAble";
}
@Override
@Cacheable(name = "mycache", key = "#(key)", liveSeconds = 5)
public String cacheAbleLive(String key) {
System.out.println("cacheAbleLive invoked!!!!");
return key + " from CacheServiceImpl.cacheAbleLive";
}
@Override
@CachePut(name = "mycache1111", key = "#(key)", liveSeconds = 15)
public String putCache(String key) {
return key + " from CacheServiceImpl.putCache";
}
/**
* 只能删除指定name,key的缓存
*
* @param key
*/
@Override
@CachesEvict({@CacheEvict(name = "mycache", key = "*"), @CacheEvict(name = "mycache1111", key = "*")})
public void cacheEvict(String key) {
}
/**
* 只能删除指定name,key的缓存
*
* @param key
*/
@Override
@CacheEvict(name = "mycache", key = "*")
public void cacheEvict1(String key) {
throw new NullPointerException("xxxx");
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Java
1
https://gitee.com/JavaLead/jboot.git
git@gitee.com:JavaLead/jboot.git
JavaLead
jboot
jboot
master

搜索帮助