1 新建springboot項目
?
2 相關(guān)注解
@EnableCaching 在啟動類上加上注解啟動緩存
#作用在你要緩存的數(shù)據(jù)上
@Cacheable(key="#id",cacheNames="com.sxt.service.impl.MenuServiceImpl")
@Cacheput 解決臟讀
@CachEvict(解決臟讀)文章來源:http://www.zghlxwxcb.cn/news/detail-606468.html
@Cacheconfig(全局的配置緩存)文章來源地址http://www.zghlxwxcb.cn/news/detail-606468.html
3 修改yml
#
spring:
#數(shù)據(jù)源
datasource:
driver-class-name: co
到了這里,關(guān)于redis(12):springboot使用redis注解做緩存的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!