首页>代码>Spring Boot整合Ehcache的简单入门实例>/ehcache2/src/main/java/com/memorynotfound/springboot/MusicService.java
package com.memorynotfound.springboot;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cache.annotation.*;
import org.springframework.stereotype.Service;

@Service
@CacheConfig(cacheNames = "instruments")
public class MusicService {

    private static Logger log = LoggerFactory.getLogger(MusicService.class);

    @CacheEvict(allEntries = true)
    public void clearCache(){}

    @Cacheable(condition = "#instrument.equals('zuidaima')")
    public String play(String instrument) {
        log.info("Executing: " + this.getClass().getSimpleName() + ".play(\"" + instrument + "\");");
        return "paying " + instrument + "!";
    }

}
最近下载更多
1798672867  LV21 2021年5月22日
13940562934  LV21 2021年4月29日
912299793  LV21 2021年4月21日
文成1116  LV21 2020年12月30日
最近浏览更多
hbsoft2008  LV15 3月20日
mjx201  LV11 2月28日
Brilion  LV6 2月15日
hzhsh0223  LV18 2月3日
anbangchen89  LV2 2月2日
yohohero  LV1 1月15日
落后就要挨打  LV26 1月13日
levmar  LV12 1月12日
wangqiang888 2022年12月24日
暂无贡献等级
内心向阳  LV4 2022年11月30日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友