首页>代码>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 LV22
2021年4月29日
912299793 LV21
2021年4月21日
文成1116 LV21
2020年12月30日

woldxy LV12
9月28日
siximu912 LV10
9月19日
EthanGrant
7月31日
暂无贡献等级
tonghao LV18
6月17日
sixiongbin LV8
5月22日
GeminiLong LV6
4月27日
hhhhhz LV7
4月18日
hbsoft2008 LV16
3月20日
mjx201 LV11
2月28日
Brilion LV6
2月15日