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

为什么网站目录不收录外卖平台做网站

为什么网站目录不收录,外卖平台做网站,做网站彩票网站,外贸人才网官网文章目录 简介引入依赖application.yml配置常用注解使用1. 启动类添加注解使用方法上添加注解 简介 Spring Cache是一个框架#xff0c;实现了基于注解的缓存功能底层可以使用EHCache、Caffeine、Redis实现缓存。 注解一般放在Controller的方法上#xff0c;CachePut 注解一… 文章目录 简介引入依赖application.yml配置常用注解使用1. 启动类添加注解使用方法上添加注解 简介 Spring Cache是一个框架实现了基于注解的缓存功能底层可以使用EHCache、Caffeine、Redis实现缓存。 注解一般放在Controller的方法上CachePut 注解一般有两个参数第一个时存储的名称第二个时名称后边的key使用SpEL动态的计算key。其余的注解也都是这两个参数。在用户端的查询操作需要使用Cacheable服务器端的增删改都使用CacheEvict 引入依赖 SpringCache dependencygroupIdorg.springframework.boot/groupIdartifactIdspring-boot-starter-cache/artifactId /dependencyRedis dependencygroupIdorg.springframework.boot/groupIdartifactIdspring-boot-starter-data-redis/artifactId /dependencymysql dependencygroupIdmysql/groupIdartifactIdmysql-connector-java/artifactIdscoperuntime/scope /dependencymybatis dependencygroupIdorg.mybatis.spring.boot/groupIdartifactIdmybatis-spring-boot-starter/artifactIdversion2.2.0/version /dependencyapplication.yml配置 server:port: 8888 spring:datasource:druid:driver-class-name: com.mysql.cj.jdbc.Driverurl: jdbc:mysql://localhost:3306/test?serverTimezoneAsia/ShanghaiuseUnicodetruecharacterEncodingutf-8zeroDateTimeBehaviorconvertToNulluseSSLfalseallowPublicKeyRetrievaltrueusername: rootpassword: 123456redis:host: localhostport: 6379password: 123456database: 1 logging:level:com:itheima:mapper: debugservice: infocontroller: info 常用注解 使用 1. 启动类添加注解 package com.itheima;import lombok.extern.slf4j.Slf4j; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cache.annotation.EnableCaching;Slf4j SpringBootApplication ----------------------------------------- 添加下面的注解 EnableCaching ----------------------------------------- public class CacheDemoApplication {public static void main(String[] args) {SpringApplication.run(CacheDemoApplication.class,args);log.info(项目启动成功...);} } 使用方法上添加注解 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//参数1缓存名称参数2动态获取方法参数字段//最总保存效果是 [参数1::参数2]。例如[userCache::1]CachePut(cacheNames userCache, key #user.id)//也可以这样写参数2不再是方法参数而是方法的返回值//CachePut(cacheNames userCache,key #result.id)//也可以这样写p0代表第一个参数p1代表第二个参数//CachePut(cacheNames userCache, key #p0.id)public User save(RequestBody User user) {userMapper.insert(user);return user;}//删除 userCache::idCacheEvict(cacheNames userCache, key #id)DeleteMappingpublic void deleteById(Long id) {userMapper.deleteById(id);}//删除 所有的 userCache::*CacheEvict(cacheNames userCache, allEntries true)DeleteMapping(/delAll)public void deleteAll() {userMapper.deleteAll();}//cache生成 userCache::idCacheable(cacheNames userCache, key #id)GetMappingpublic User getById(Long id) {User user userMapper.getById(id);return user;}}
http://www.zqtcl.cn/news/525759/

相关文章:

  • 制作手机端网站开发厦门网站设计定制
  • 佛山网站开发公司做网站在什么地方发帖子呢
  • 无网站可以做cpc吗wordpress 12张表
  • 有些中小网站cnzz网站排名是怎么做的
  • 深圳做微商网站的公司高端做网站价格
  • 在线原型设计网站wordpress菜单页内跳转
  • 做电影网站要买什么抖音推广怎么收费
  • 专业的公司网站开发网站按钮设计
  • 南宁网站建设是什么深圳公司有哪些
  • 杭州手机申请网站登录怎么做电子商务网站
  • 青岛个人接网站建设wordpress 转载文章
  • 网上做网站任务网络营销传播的核心内容
  • 做黑界头像网站成考过来人的忠告
  • 宁波网站建设是哪家便宜织梦网站数据库备份文件夹
  • 在北京大学生做家教的网站淘宝网页
  • 英铭网站建设网站如何推广引流
  • 关于电子商务网站建设的现状企业公示信息查询系统山西
  • 网站开发 翻译长春建站企业
  • dedecms网站网站解析一般什么时候
  • 制作网站的技术北京律师24小时电话
  • 可拖拽 网站建设如何做自媒体和网站签约赚点击
  • 做网站选哪个语言怎么登录百度app
  • 国发网站建设网站优化主要优化哪些地方
  • 快速微信网站开发定制网站建设费用预算
  • 网站制作叫什么知名网站建设制作
  • 网络营销网站建设公司h5应用
  • 网站开发合同要上印花税吗南江红鱼洞水库建设管理局网站
  • 疏通下水道网站怎么做wordpress 恢复初始化
  • 电脑商业网站怎的做软文推广渠道
  • 自己做网站需要买什么如何做微信商城网站