首页>代码>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 + "!"; } }

我真的是小明 LV10
2024年12月29日
1798672867 LV21
2021年5月22日
13940562934 LV22
2021年4月29日
912299793 LV21
2021年4月21日
文成1116 LV21
2020年12月30日

srmess LV4
2024年12月31日
我真的是小明 LV10
2024年12月29日
woldxy LV12
2023年9月28日
siximu912 LV10
2023年9月19日
EthanGrant
2023年7月31日
暂无贡献等级
tonghao LV18
2023年6月17日
sixiongbin LV8
2023年5月22日
GeminiLong LV6
2023年4月27日
hhhhhz LV7
2023年4月18日
hbsoft2008 LV16
2023年3月20日