1 Star 0 Fork 953

jlcoding/jboot

forked from JbootProjects/jboot 
Create your Gitee Account
Explore and code with more than 14 million developers,Free private repositories !:)
Sign up
文件
Clone or Download
CacheServiceImpl.java 1.47 KB
Copy Edit Raw Blame History
Michael Yang authored 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/msgcode/jboot.git
git@gitee.com:msgcode/jboot.git
msgcode
jboot
jboot
master

Search