当前位置: 首页 > 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.pierceye.com/news/525759/

相关文章:

  • 网站设计素材网站cpa个人网站怎么做
  • 做徽标的网站做软件去哪个网站
  • 网站初始开发的步骤自己做的网站有排名吗
  • 山东建设厅官方网站一级建造师有什么网站可以做代理的
  • 哪个网站公司做的好百科网站推广
  • 网站首页做很多个关键词做羊水亲子鉴定网站
  • 漳州 做网站东昌府区住房和城乡建设局网站
  • 网站前台首页无法显示济南市网站
  • c2c网站开发毕业设计东莞网站营销公司
  • 网站维护企业wordpress数字分页
  • 怎么判断一个网站做的好不好discuz 企业网站
  • 编程入门自学网站中国室内设计网站排名
  • 北京房山网站建设产品更新培训如何用手机编程游戏
  • 重庆城乡建设网站神马搜索seo优化排名
  • 北京响应式网站制作公司一个网站的建设流程有哪些资料
  • 专做淘宝的网站全部网站
  • 济南网站app开发的相册网站建设目的
  • 哈尔滨网站优化推广公司wordpress引用js插件
  • 网站优化软件排名器制作文字图片
  • 广州十大网站建设怎么做网站的301
  • 青岛网站运营推广移动端网站开发项目报告
  • 上海 培训网站建设现在最火的推广平台有哪些
  • 公司网站制作设计联系方式网站如何做ssl认证
  • 中国城乡住房和城乡建设部网站首页内江seo
  • 外贸经常用的网站深圳专业网站建设定制
  • 网站建设项目签约仪式举行注册网站不用手机短信验证的
  • 汕头建站模板源码网站如何做视频链接地址
  • wordpress 取消赞广东seo推广软件
  • 网站一个多少钱做网站意义和目的
  • 做网站要用编程吗学做宝宝衣服的网站