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

做一个网站的费用构成建筑工程网上申报

做一个网站的费用构成,建筑工程网上申报,基本网站建设技术,帮我搜一下长沙做网络销售Nosql和缓存的背景 数据库架构设计的发展史 第一阶段#xff1a;单库#xff1a;随着访问量的增加出现了性能问题 第二阶段#xff1a;缓存#xff1a;通过缓存#xff0c;缓解数据库的压力#xff0c;优化数据结构和索引 第三阶段#xff1a;读写分离#xff1a;数据…Nosql和缓存的背景 数据库架构设计的发展史 第一阶段单库随着访问量的增加出现了性能问题 第二阶段缓存通过缓存缓解数据库的压力优化数据结构和索引 第三阶段读写分离数据写入的压力增加主从复制和读写分离的方案进入视野 第四阶段分库分表主表的写压力过高开始使用InnoDB引擎以及分库分表技术 核心问题 传统数据库的扩展性差需要复杂的技术来实现大数据下IO压力大表结构更加困难 持久化方式 持久化将数据如内存中的对象保存到可永久保存的存储设备中 方式一RDB方式 在指定的时间间隔内对数据进行快照存储。先将数据集写入临时文件写入成功后再替换之前的文件用二进制压缩存储是一次的全量备份 方式二AOF方式 以日志文本的形式记录服务器所处理的每一个数据更改指令然后通过重放来恢复数据是连续的增量备份 Redis整合SpringDataRedis Spring Data是Spring公司的顶级项目里面包含了N多个二级子项目这些子项目都是相当独立的项目。每个子项目是对不同API的封装 所有Spring Boot整合Spring Data xxx的启动器都叫做spring-boot-starter-data-xxx Spring Data好处很方便操作对象类型。 把Redis不同值的类型放到一个opsForxxx方法中 opsForValueString值 opsForList列表List opsForHash哈希表Hash opsForZSet有序集合Sorted Set opsForSet集合 使用步骤 1.添加依赖 !--导入redis依赖--dependencygroupIdorg.springframework.boot/groupIdartifactIdspring-boot-starter-data-redis/artifactIdversion2.5.0/version/dependency2.配置文件 spring.datasource.driver-class-namecom.mysql.jdbc.Driver spring.datasource.urljdbc:mysql://localhost:3306/userdb?characterEncodingutf8 spring.datasource.usernameroot spring.datasource.password123456mybatis.type-aliases-packagecom.zuxia.entity mybatis.mapper-locationsclasspath:mapper/*.xml#配置redis 服务参数 spring.redis.database1 spring.redis.host127.0.0.1 spring.redis.port6379 spring.redis.passwordspring.redis.jedis.pool.max-active80 spring.redis.jedis.pool.max-wait-1spring.redis.jedis.pool.max-idle50spring.redis.jedis.pool.min-idle30spring.redis.timeout5003.编写配置类 Configuration public class RedisConfig {Beanpublic RedisTemplateString,Object redisTemplate(RedisConnectionFactory factory){RedisTemplateString ,Object redisTemplatenew RedisTemplate();redisTemplate.setKeySerializer(new StringRedisSerializer());redisTemplate.setValueSerializer(new Jackson2JsonRedisSerializerObject(Object.class));redisTemplate.setConnectionFactory(factory);return redisTemplate;} }Controller类 package com.zuxia.controller;import com.sun.org.apache.xpath.internal.operations.Mod; import com.zuxia.entity.Product; import com.zuxia.service.IProduct; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody;Controller public class ProductController {Autowiredprivate IProduct iProduct;GetMapping(/show)public String select(Integer id, Model model){Product product iProduct.findByID(id);model.addAttribute(product,product);return show;}RequestMapping(/del)ResponseBodypublic String del(Integer id, Model model){int iiProduct.del(id);if(i0){return 删除成功;}return 删除失败;}RequestMapping(/update )ResponseBodypublic String update(Product product, Model model){int iiProduct.update(product);if(i0){return 修改成功;}return 修改失败;}RequestMapping(/add)ResponseBodypublic String Add(Product product, Model model){int iiProduct.insert(product);if(i0){return 增加成功;}return 曾加失败;} } Service类 package com.zuxia.service.impl;import com.zuxia.entity.Product; import com.zuxia.mapper.ProductMapper; import com.zuxia.service.IProduct; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer; import org.springframework.stereotype.Service;Service public class ProductServiceImpl implements IProduct {Autowired(required false)private ProductMapper productMapper;Autowiredprivate RedisTemplateString,Object redisTemplate;Overridepublic Product findByID(Integer id) {String keyproduct:id;//先从redis中获取数据if(redisTemplate.hasKey(key)){//判断id是否在缓存中存在System.out.println(执行缓存);//设置value的值redisTemplate.setValueSerializer(new Jackson2JsonRedisSerializerProduct(Product.class));//从缓存中获取数据Product product(Product) redisTemplate.opsForValue().get(key);return product;}System.out.println(执行mysql数据查询);Product productproductMapper.findByID(id);//将查到的值存入缓存中redisTemplate.opsForValue().set(key,product);return product;}Overridepublic int del(Integer id) {int iproductMapper.del(id);String keyprodoct:id;//判断缓存中是否存在boolean ret redisTemplate.hasKey(key);if(ret){System.out.println(缓存中的数据删除了);redisTemplate.delete(key);}return i;}Overridepublic int update(Product product) {int iproductMapper.update(product);if(i0){String keyproductproduct.getId();if(redisTemplate.hasKey(key)){System.out.println(缓存的数据更改了);redisTemplate.opsForValue().set(key,product);}}return i;}Overridepublic int insert(Product product) {return productMapper.insert(product);} }
http://wiki.neutronadmin.com/news/347032/

相关文章:

  • 网站上社保做增员怎么做做网站要营业执照吗
  • seo黑帽排名站长工具的使用seo综合查询运营
  • 网站公司怎么做推广网页版式设计案例
  • we建站电脑网页无法打开是什么原因
  • 南城网站建设多少钱湖北省建设信息网站
  • 南宁网站建设专家网站设计需要哪些
  • 企业网站的首页设计模板wordpress图片域名
  • 网站相对路径和绝对路径做新得网站可以换到原来得域名嘛
  • 做相册的网站wordpress衔接出错
  • 龙岗网站建设哪家便宜乐山市住房和城乡规划建设局网站
  • 合肥做网站的企业济南网站技术
  • 运营网站开发工作滨州做网站建设的公司
  • 奉贤网站建设网站制作银川做网站最好的公司有哪些
  • 做企业网站推广多少钱服务器可以自己的网站吗
  • 云南建设厅查证网站合肥网站排名推广
  • 机关公文写作网站房地产网站建设公司
  • 购物网站模板下载精准大数据营销是什么
  • 哪两个数字域名是做医疗信息网站的有空间有域名怎么做网站
  • 网站开发过时了湖南刚刚发生的大事件
  • 网站广告代码怎么添加常州外贸网站设计
  • 可以发广告的100个网站圣都装饰
  • thinkphp旅游网站源码房屋装修设计图片欣赏
  • 网站建设按钮外贸推广app
  • dede重工蓝色企业免费网站模板没有营业执照 怎么做网站
  • 网站架构策划重庆百度推广seo
  • 网站建设的团队分工企业查询软件免费
  • 鹰潭市城乡建设局网站代理服务器国外
  • 南京网站建设q润洽网络做网站的开发工具
  • 网站排名对比wordpress投稿管理系统
  • 旅游网站功能现在可以去贵阳吗