当前位置: 首页 > news >正文

阿里云云服务器 网站配置微信小程序免费制作平台

阿里云云服务器 网站配置,微信小程序免费制作平台,做俄罗斯网站,互联网产品设计公司Spring Cache是一个框架,实现了基于注解的缓存功能,只需要简单地加一个注解,就能实现缓存功能。 Spring Cache提供了一层抽象,底层可以切换不同的缓存实现,例如: ①EHCache ②Caffeine ③Redis 常用注解…

Spring Cache是一个框架,实现了基于注解的缓存功能,只需要简单地加一个注解,就能实现缓存功能。

Spring Cache提供了一层抽象,底层可以切换不同的缓存实现,例如:

①EHCache

②Caffeine

③Redis

常用注解:

代码开发:

package com.itheima.controller;import com.itheima.entity.User;
import com.itheima.mapper.UserMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.CachePut;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.web.bind.annotation.*;@RestController
@RequestMapping("/user")
@Slf4j
public class UserController {@Autowiredprivate UserMapper userMapper;@PostMapping@CachePut(cacheNames = "userCache",key="#user.id")//如果使用Spring Cache缓存数据,key的生成:userCache::1public User save(@RequestBody User user){userMapper.insert(user);return user;}@DeleteMapping@CacheEvict(cacheNames = "userCache",key = "#id")public void deleteById(Long id){userMapper.deleteById(id);}@DeleteMapping("/delAll")@CacheEvict(cacheNames = "userCache",allEntries = true)public void deleteAll(){userMapper.deleteAll();}@GetMapping@Cacheable(cacheNames = "userCache",key = "#id")//key的生成:userCache::10public User getById(Long id){User user = userMapper.getById(id);return user;}}

http://www.hrbkazy.com/news/15414.html

相关文章:

  • 村网站建设计划书江西seo推广
  • 怎么才能注册做网站合肥网站优化技术
  • 深圳做网站好的公司宁波seo快速排名
  • 网站怎么做背景图片百度软件应用中心下载
  • 新闻动态网站的设计下载百度卫星导航
  • 哪个网站可以做会计题全网自媒体平台大全
  • 销售营销方案100例网络优化工程师前景
  • 网站开发合同编号如何编写指数函数图像
  • 南通营销网站建设网络推广费用大概价格
  • 扬中网站网站优化公司哪家效果好
  • 网站建设供需网站推荐
  • 哪里有做枪网站的怎么寻找网站关键词并优化
  • wordpress政府网站网络销售怎么样
  • 眉山手机网站建设seo是什么级别
  • ui设计技能就业培训谷歌优化的最佳方案
  • 开县网站建设肇庆seo外包公司
  • 天津网站定制网络推广都是收费
  • 可以做长页海报的网站凡科建站和华为云哪个好
  • 成都大型网站设计公司站长之家ping检测
  • 12388网站建设管理情况山东最新资讯
  • 设计良好的网站一般需要怎么做seo怎么优化网站排名
  • 重庆装修公司推荐专业北京seo公司
  • 学生做家教网站兰州模板网站seo价格
  • 全网网站建设维护百度关键词规划师
  • 网页的网站导航怎么做太原网站优化公司
  • 网站优化计划书聚合搜索引擎入口
  • 网站空间如何选择进一步优化营商环境
  • 徐州网站平台制作公司cctv 13新闻频道
  • 西安网站建设流程seo主要优化
  • 自己电脑做服务器发布网站用模板快速建站