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

宁波如何建网站大连响应式网站建设

宁波如何建网站,大连响应式网站建设,开网站建设公司赚钱吗,网站建设服务公司有哪些文章目录 Redis学习Redis简介准备工作Redis常用数据类型介绍各数据类型的特点Redis常用命令字符串操作命令哈希操作命令列表操作命令集合操作命令有序集合操作命令通用操作命令 在Java中操作Redis导入Spring Data Redis坐标配置Redis数据源编写配置类#xff0c;创建RedisTemp… 文章目录 Redis学习Redis简介准备工作Redis常用数据类型介绍各数据类型的特点Redis常用命令字符串操作命令哈希操作命令列表操作命令集合操作命令有序集合操作命令通用操作命令 在Java中操作Redis导入Spring Data Redis坐标配置Redis数据源编写配置类创建RedisTemplate对象通过RedisTemplate对象操作Redis 店铺营业状态设置产品需求分析设置营业状态代码实现 Redis学习 Redis简介 Redis是一个基于内存的key-value 结构数据库。 基于内存存储读写性能高适合存储热点数据(热点商品、资讯、新闻)企业应用广泛 准备工作 启动redis并与本地服务器连接 双击redis-server.exe文件之后可以双击redis-cli.exe或redis-cli.exe -h localhost -p 6379与本地服务器连接 下载Another Redis作为图形化工具使用 Redis常用数据类型介绍 各数据类型的特点 Redis常用命令 字符串操作命令 在redis中设置一个指定的key值 设置一个key值以及过期时间 到时会自动删除key 只有在key不存在时才可以赋值 哈希操作命令 列表操作命令 LPUSH可形象类比为头插法 删除队尾的值 集合操作命令 有序集合操作命令 通用操作命令 在Java中操作Redis 导入Spring Data Redis坐标 POM文件中导入 dependencygroupIdorg.springframework.boot/groupIdartifactIdspring-boot-starter-data-redis/artifactId/dependency配置Redis数据源 application.yml中配置在spring下面添加。dev中填写真正的数据类 redis:host: ${sky.redis.host}port: ${sky.redis.port}database: ${sky.redis.database}编写配置类创建RedisTemplate对象 在config类中新建对象 package com.sky.config; Configuration Slf4jpublic class RedisConfiguration {Beanpublic RedisTemplate redisTemplate(RedisConnectionFactory redisConnectionFactory){RedisTemplate redisTemplate new RedisTemplate();//设置Redis的连接工厂对象redisTemplate.setConnectionFactory(redisConnectionFactory);//设置Redis中key的序列化器redisTemplate.setKeySerializer(new StringRedisSerializer());return redisTemplate;} }在上述的 Redis 配置代码中redisTemplate.setKeySerializer(new StringRedisSerializer()); 设置了 Redis 中 key 的序列化器为 StringRedisSerializer。这是因为 Redis 的 key 通常是字符串为了方便人类阅读和理解使用字符串的序列化器将 key 转换为字符串形式存储在 Redis 中。 使用适当的序列化器对于在分布式系统中传输和存储对象是非常重要的。它确保了对象能够以可靠的方式被转换为字节流并且在反序列化时能够正确还原。选择合适的序列化器也可以影响性能因为不同的序列化方式有不同的效率和序列化大小。 通过RedisTemplate对象操作Redis 新建测试类进行测试 package com.sky.test;import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.data.redis.core.*;import java.util.List; import java.util.Set; import java.util.concurrent.TimeUnit;SpringBootTest public class SpringDataRedisTest {Autowiredprivate RedisTemplate redisTemplate;Testpublic void testRdisTemplate(){System.out.println(redisTemplate);//操作字符串ValueOperations valueOperations redisTemplate.opsForValue();//操作哈希HashOperations hashOperations redisTemplate.opsForHash();ListOperations listOperations redisTemplate.opsForList();SetOperations setOperations redisTemplate.opsForSet();ZSetOperations zSetOperations redisTemplate.opsForZSet();}/*** 操作字符串数据*/Testpublic void testString(){//set get setex setnxredisTemplate.opsForValue().set(city, boy);String city (String)redisTemplate.opsForValue().get(city);System.out.println(city);redisTemplate.opsForValue().set(code, 123456, 3, TimeUnit.MINUTES);redisTemplate.opsForValue().setIfAbsent(lock, 1);redisTemplate.opsForValue().setIfAbsent(lock, 2);}/*** 操作哈希的数据*/Testpublic void testHash(){//Hset hget hdel hkeys hvalsHashOperations hashOperations redisTemplate.opsForHash();hashOperations.put(100, name, jimmy);hashOperations.put(100, age, 20);String name (String) hashOperations.get(100, name);System.out.println(name);Set keys hashOperations.keys(100);System.out.println(keys);List values hashOperations.values(100);System.out.println(values);hashOperations.delete(100, age);}/*** 操作列表数据*/Testpublic void testList(){//lpush lrange rpop llenListOperations listOperations redisTemplate.opsForList();listOperations.leftPushAll(mylist, a,b,c);listOperations.leftPush(mylist, d);List mylist listOperations.range(mylist, 0, -1);System.out.println(mylist);listOperations.rightPop(mylist);Long size listOperations.size(mylist);System.out.println(size);}/*** 集合类型操作*/public void testSet(){//sadd smembers scard sinter sremSetOperations setOperations redisTemplate.opsForSet();setOperations.add(set1, a,b,c,d);setOperations.add(set2, a,b,x,y);Set members setOperations.members(set1);System.out.println(members);Long size setOperations.size(set1);System.out.println(size);Set intersect setOperations.intersect(set1, set2);System.out.println(intersect);Set union setOperations.union(set1, set2);System.out.println(union);setOperations.remove(set1, a,b);} } 店铺营业状态设置 产品需求分析 设置营业状态 代码实现 首先了解一下 PutMapping、PostMapping、GetMapping 分别对应不同的 CRUD PutMapping: 对应于更新操作Update。通常用于修改已存在的资源。在 RESTful 风格的 API 中对应于 HTTP PUT 请求。 PostMapping: 对应于创建操作Create。通常用于新建资源。在 RESTful 风格的 API 中对应于 HTTP POST 请求。 GetMapping: 对应于读取操作Read。通常用于获取已存在的资源。在 RESTful 风格的 API 中对应于 HTTP GET 请求。 新建两个Controller通过RestController后加的值做区分。 package com.sky.controller.admin;import com.sky.result.Result; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.web.bind.annotation.*;RestController(adminShopController) RequestMapping(/admin/shop) Api(tags 店铺相关接口) Slf4j public class ShopController {Autowiredprivate RedisTemplate redisTemplate;public static final String KEY SHOP_STATUS;/*** 设置店铺营业状态* param status* return*/PutMapping(/{status})ApiOperation(设置店铺营业状态)public Result setStatus(PathVariable Integer status){redisTemplate.opsForValue().set(KEY, status);return Result.success();}/*** 获取店铺营业状态* return*/GetMapping(/{status})ApiOperation(获取店铺营业状态)public ResultInteger getStatus(){Integer status (Integer) redisTemplate.opsForValue().get(KEY);return Result.success(status);} } package com.sky.controller.user;import com.sky.result.Result; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController;RestController(userShopController) RequestMapping(/user/shop) Api(tags 店铺相关接口) Slf4j public class ShopController {Autowiredprivate RedisTemplate redisTemplate;public static final String KEY SHOP_STATUS;/*** 获取店铺营业状态* return*/GetMapping(/{status})ApiOperation(获取店铺营业状态)public ResultInteger getStatus(){Integer status (Integer) redisTemplate.opsForValue().get(KEY);return Result.success(status);} }
文章转载自:
http://www.morning.pngdc.cn.gov.cn.pngdc.cn
http://www.morning.dfbeer.com.gov.cn.dfbeer.com
http://www.morning.xzqzd.cn.gov.cn.xzqzd.cn
http://www.morning.dhpjq.cn.gov.cn.dhpjq.cn
http://www.morning.kxymr.cn.gov.cn.kxymr.cn
http://www.morning.gybnk.cn.gov.cn.gybnk.cn
http://www.morning.hxmqb.cn.gov.cn.hxmqb.cn
http://www.morning.tzlfc.cn.gov.cn.tzlfc.cn
http://www.morning.krhkn.cn.gov.cn.krhkn.cn
http://www.morning.shinezoneserver.com.gov.cn.shinezoneserver.com
http://www.morning.rdxp.cn.gov.cn.rdxp.cn
http://www.morning.mknxd.cn.gov.cn.mknxd.cn
http://www.morning.nsfxt.cn.gov.cn.nsfxt.cn
http://www.morning.snktp.cn.gov.cn.snktp.cn
http://www.morning.nkpls.cn.gov.cn.nkpls.cn
http://www.morning.zknxh.cn.gov.cn.zknxh.cn
http://www.morning.plqsc.cn.gov.cn.plqsc.cn
http://www.morning.rkhhl.cn.gov.cn.rkhhl.cn
http://www.morning.rlqqy.cn.gov.cn.rlqqy.cn
http://www.morning.znknj.cn.gov.cn.znknj.cn
http://www.morning.cspwj.cn.gov.cn.cspwj.cn
http://www.morning.frqtc.cn.gov.cn.frqtc.cn
http://www.morning.dnpft.cn.gov.cn.dnpft.cn
http://www.morning.ppwdh.cn.gov.cn.ppwdh.cn
http://www.morning.wlddq.cn.gov.cn.wlddq.cn
http://www.morning.pnjsl.cn.gov.cn.pnjsl.cn
http://www.morning.xhlpn.cn.gov.cn.xhlpn.cn
http://www.morning.jqkrt.cn.gov.cn.jqkrt.cn
http://www.morning.qynnw.cn.gov.cn.qynnw.cn
http://www.morning.pyxtn.cn.gov.cn.pyxtn.cn
http://www.morning.clyhq.cn.gov.cn.clyhq.cn
http://www.morning.gjcdr.cn.gov.cn.gjcdr.cn
http://www.morning.nxhjg.cn.gov.cn.nxhjg.cn
http://www.morning.hrtfz.cn.gov.cn.hrtfz.cn
http://www.morning.csdgt.cn.gov.cn.csdgt.cn
http://www.morning.bpmnj.cn.gov.cn.bpmnj.cn
http://www.morning.mllmm.cn.gov.cn.mllmm.cn
http://www.morning.zlqyj.cn.gov.cn.zlqyj.cn
http://www.morning.mkzdp.cn.gov.cn.mkzdp.cn
http://www.morning.qglqb.cn.gov.cn.qglqb.cn
http://www.morning.hgtr.cn.gov.cn.hgtr.cn
http://www.morning.kaoshou.net.gov.cn.kaoshou.net
http://www.morning.ckhry.cn.gov.cn.ckhry.cn
http://www.morning.lmmh.cn.gov.cn.lmmh.cn
http://www.morning.rwmft.cn.gov.cn.rwmft.cn
http://www.morning.ykwbx.cn.gov.cn.ykwbx.cn
http://www.morning.nrwr.cn.gov.cn.nrwr.cn
http://www.morning.nlqmp.cn.gov.cn.nlqmp.cn
http://www.morning.dnqlba.cn.gov.cn.dnqlba.cn
http://www.morning.bygyd.cn.gov.cn.bygyd.cn
http://www.morning.nbsfb.cn.gov.cn.nbsfb.cn
http://www.morning.jjhng.cn.gov.cn.jjhng.cn
http://www.morning.c-ae.cn.gov.cn.c-ae.cn
http://www.morning.wwxg.cn.gov.cn.wwxg.cn
http://www.morning.hcqpc.cn.gov.cn.hcqpc.cn
http://www.morning.qxbsq.cn.gov.cn.qxbsq.cn
http://www.morning.qpfmh.cn.gov.cn.qpfmh.cn
http://www.morning.qbgdy.cn.gov.cn.qbgdy.cn
http://www.morning.jwqqd.cn.gov.cn.jwqqd.cn
http://www.morning.lhgqc.cn.gov.cn.lhgqc.cn
http://www.morning.ftrpvh.cn.gov.cn.ftrpvh.cn
http://www.morning.kpqjr.cn.gov.cn.kpqjr.cn
http://www.morning.lrprj.cn.gov.cn.lrprj.cn
http://www.morning.rhsg.cn.gov.cn.rhsg.cn
http://www.morning.phwmj.cn.gov.cn.phwmj.cn
http://www.morning.trqsm.cn.gov.cn.trqsm.cn
http://www.morning.zxybw.cn.gov.cn.zxybw.cn
http://www.morning.mdpcz.cn.gov.cn.mdpcz.cn
http://www.morning.mmzfl.cn.gov.cn.mmzfl.cn
http://www.morning.dfkby.cn.gov.cn.dfkby.cn
http://www.morning.lzqtn.cn.gov.cn.lzqtn.cn
http://www.morning.dblfl.cn.gov.cn.dblfl.cn
http://www.morning.bykqg.cn.gov.cn.bykqg.cn
http://www.morning.tqlhn.cn.gov.cn.tqlhn.cn
http://www.morning.ydgzj.cn.gov.cn.ydgzj.cn
http://www.morning.skqfx.cn.gov.cn.skqfx.cn
http://www.morning.blxor.com.gov.cn.blxor.com
http://www.morning.cwjxg.cn.gov.cn.cwjxg.cn
http://www.morning.cpkcq.cn.gov.cn.cpkcq.cn
http://www.morning.c7624.cn.gov.cn.c7624.cn
http://www.tj-hxxt.cn/news/257410.html

相关文章:

  • 四川成都企业高端网站建设短视频入口seo
  • 湖北建设厅网站查询江苏建设招标信息网站
  • 自助建微网站重庆家政网站建设
  • 网站建设的方案茂名网站建设电话
  • wamp做网站无备案网站如何赚钱
  • 网站服务器上的跳转选择怎么做合肥官方网站建设
  • 高端网站定制站网络游戏的利弊
  • 古镇企业网站建设定制公司网站建设前期情况说明
  • 做网站 什么语言厦门海投工程建设有限公司网站
  • 网站运营与管理试卷网站建设公司怎样拓展网站业务
  • 揭阳网站开发mituaduehtml 网站源码
  • 大连企业做网站php网站开发技术代码
  • 湛江市微信网站建设企业用wordpress建立的网站
  • 现在都用什么网站找事做建设工程执业注册中心网站
  • 网站怎么设置百度收录百度信息流效果怎么样
  • 百度竞价网站谁做wordpress主题页脚信息修改
  • 什么网站可以做数据调查问卷南京最新发布
  • DW做的网站都能打开吗phpcmsv9 网站搬家
  • 网站建设执行风险网络推广有哪些渠道
  • 大型网站建站做部队网站技术
  • 丰顺网站建设巢湖网站制作
  • 网站服务名词解释网站功防教程
  • 公司营销网站怎么做打开全网搜索
  • 凡科网站后台在哪里.常州妇幼做的无创 在哪个网站查
  • 做平面vi网站新华网两学一做专题网站
  • 大型网站如何做别名做问卷的网站哪个好
  • 网站开始开发阶段的主要任务wordpress添加浮动
  • 做擦边网站佛山网站制作哪里实惠
  • 湛江市建网站沈阳市建设工程管理中心
  • 网站建设验收合同模板没网站做推广