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

网站banner分辨率网络推广哪个平台好

网站banner分辨率,网络推广哪个平台好,网站建设有哪些软件,黄骅贴吧百度贴吧文章目录 1、Redis 基本操作Redis 默认有 16 个数据库,使用的是第 0 个,切换数据库添加数据/修改数据查询数据批量添加批量查询删除数据查询所有的 key清除当前数据库清除所有数据库查看 key 是否存在设置有效期查看有效期 2、Redis 数据类型String追加字…

文章目录

  • 1、Redis 基本操作
    • Redis 默认有 16 个数据库,使用的是第 0 个,切换数据库
    • 添加数据/修改数据
    • 查询数据
    • 批量添加
    • 批量查询
    • 删除数据
    • 查询所有的 key
    • 清除当前数据库
    • 清除所有数据库
    • 查看 key 是否存在
    • 设置有效期
    • 查看有效期
  • 2、Redis 数据类型
    • String
      • 追加字符串
      • 查看字符串长度
      • 自增
      • 递减
      • 指定递增长度
      • 指定递减长度
      • 字符串截取
      • 修改局部字段
    • List
      • 从左侧添加
      • 从右侧添加
      • 取值
      • 删除,左侧移除
      • 右侧移除
      • 通过下标获取值
      • 删除集合中指定的值,count 是删除的个数
      • 通过下标修改集合中的值
      • 获取长度
      • 截取list
      • 查看集合是否存在
    • Set
      • 添加数据
      • 查询数据
      • 判断集合中是否存在某个值
      • 获取集合长度
      • 删除元素
      • 随机取值
    • Hash
      • 存值
      • 取值
      • 存多个值
      • 取多个值
      • 取所有值
      • 删除数据
      • 获取长度
      • 判断集合中是否存在某个值
      • 获取集合中所有 key
      • 获取集合中所有 value
    • Zset
      • 添加数据
      • 查询数据
      • 升序查询
      • 降序查询
      • 删除数据
  • 3、Spring Boot 整合 Redis

1、Redis 基本操作

Redis 默认有 16 个数据库,使用的是第 0 个,切换数据库

select 0

添加数据/修改数据

set key value

查询数据

get key

批量添加

mset k1 v1 k2 v2...

批量查询

mget k1 k2 

删除数据

del key

查询所有的 key

keys *

清除当前数据库

flushdb

清除所有数据库

flushall

查看 key 是否存在

exists key

设置有效期

expire key 10

查看有效期

ttl key

2、Redis 数据类型

String

追加字符串

append key value

查看字符串长度

strlen key

自增

incr key

递减

decr key

指定递增长度

incrby k v

指定递减长度

decrby k v

字符串截取

getrange k start end

修改局部字段

setrange k start v

List

从左侧添加

lpush k v...

从右侧添加

rpush k v...

取值

lrange k start end

删除,左侧移除

lpop k

右侧移除

rpop k

通过下标获取值

lindex k index

删除集合中指定的值,count 是删除的个数

lrem k count v

通过下标修改集合中的值

lset k index v

获取长度

llen k

截取list

ltrim k start end

查看集合是否存在

exists k

Set

添加数据

sadd k v

查询数据

smembers k

判断集合中是否存在某个值

sismember k v

获取集合长度

scard k

删除元素

srem k v1 v2...

随机取值

srandmember k

Hash

存值

hset hash k1 v1 k2 v2

取值

hget hash k1

存多个值

hmset hash k1 a k2 b k3 c

取多个值

hmget hash k1 k2 k3

取所有值

hgetall hash

删除数据

hdel hash k1 k2

获取长度

hlen k

判断集合中是否存在某个值

hexists hahs k

获取集合中所有 key

hkeys hash

获取集合中所有 value

hvals hash

Zset

添加数据

zadd set index v

查询数据

zrange set 0 -1

升序查询

zrangebyscore score -inf +inf withscores

降序查询

zrevrange score 0 -1 withscores

删除数据

zrem score jack

3、Spring Boot 整合 Redis

Spring Data Redis

<dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
<dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId>
</dependency><dependency><groupId>org.projectlombok</groupId><artifactId>lombok</artifactId><optional>true</optional>
</dependency>
<dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-test</artifactId><scope>test</scope>
</dependency><!-- Swagger -->
<dependency><groupId>io.springfox</groupId><artifactId>springfox-swagger2</artifactId><version>2.9.2</version>
</dependency>
<dependency><groupId>io.springfox</groupId><artifactId>springfox-swagger-ui</artifactId><version>2.9.2</version>
</dependency>
spring:redis:database: 0host: 192.168.248.138port: 6379
package com.southwind.entity;import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;import java.io.Serializable;
import java.util.Date;@Data
@AllArgsConstructor
@NoArgsConstructor
public class Student implements Serializable {private Integer id;private String name;private Double score;private Date birthday;
}
package com.southwind.controller;import com.southwind.entity.Student;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.*;@RestController
public class StudentController {@Autowiredprivate RedisTemplate redisTemplate;@PostMapping("/set")public void set(@RequestBody Student student){this.redisTemplate.opsForValue().set("stu", student);}@GetMapping("/get/{key}")public Student get(@PathVariable("key") String key){return (Student) this.redisTemplate.opsForValue().get(key);}@PutMapping("/put")public void update(@RequestBody Student student){this.redisTemplate.opsForValue().set("stu", student);}@DeleteMapping("/delete/{key}")public Boolean delete(@PathVariable("key") String key){this.redisTemplate.delete(key);return this.redisTemplate.hasKey(key);}
}
package com.southwind.configuration;import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;@Configuration
@EnableSwagger2
public class SwaggerConfiguration {@Beanpublic Docket createRestApi() {return new Docket(DocumentationType.SWAGGER_2).select().apis(RequestHandlerSelectors.basePackage("com.southwind")).build().apiInfo(new ApiInfoBuilder().title("Redis测试").description("测试").version("V1.0").build());}
}

字符串

@PostMapping("/string")
public String string(){String str = "Hello World";this.redisTemplate.opsForValue().set("str", str);return (String) this.redisTemplate.opsForValue().get("str");
}

List

@PostMapping("/list")
public void list(){ListOperations<String,String> list = redisTemplate.opsForList();list.leftPush("list", "Hello");list.leftPush("list", "World");list.leftPush("list","Java");list.rightPush("list", "1");list.rightPush("list", "2");list.rightPush("list", "3");
}

Set

@PostMapping("/setadd")
public void setadd(){SetOperations<String,String> set = this.redisTemplate.opsForSet();set.add("set", "Hello");set.add("set", "World");set.add("set", "Java");
}

Zset

@PostMapping("/zset")
public void zset(){ZSetOperations<String,String> set = this.redisTemplate.opsForZSet();set.add("zset", "Hello",1);set.add("zset", "World",2);set.add("zset", "Java",3);
}

Hash

@PostMapping("/hash")
public void hash(){HashOperations<String,String,String> hash = this.redisTemplate.opsForHash();hash.put("hash", "id", "1");hash.put("hash", "name", "tom");hash.put("hash", "age","22" );
}

文章转载自:
http://thymey.nLkm.cn
http://standard.nLkm.cn
http://malachite.nLkm.cn
http://outhouse.nLkm.cn
http://encapsidate.nLkm.cn
http://fulcrum.nLkm.cn
http://decohere.nLkm.cn
http://decoupage.nLkm.cn
http://decarock.nLkm.cn
http://radnor.nLkm.cn
http://emmer.nLkm.cn
http://tissular.nLkm.cn
http://government.nLkm.cn
http://mong.nLkm.cn
http://appointer.nLkm.cn
http://sulphur.nLkm.cn
http://printback.nLkm.cn
http://serge.nLkm.cn
http://inspirator.nLkm.cn
http://achillean.nLkm.cn
http://tavel.nLkm.cn
http://medicate.nLkm.cn
http://dewlap.nLkm.cn
http://entomolite.nLkm.cn
http://nazarene.nLkm.cn
http://sureness.nLkm.cn
http://tabbinet.nLkm.cn
http://carriole.nLkm.cn
http://internality.nLkm.cn
http://retranslate.nLkm.cn
http://geometric.nLkm.cn
http://amaretto.nLkm.cn
http://rhyolite.nLkm.cn
http://gawd.nLkm.cn
http://nsec.nLkm.cn
http://rosin.nLkm.cn
http://pillory.nLkm.cn
http://cantalever.nLkm.cn
http://eastside.nLkm.cn
http://criminate.nLkm.cn
http://nonoxidizable.nLkm.cn
http://exigency.nLkm.cn
http://grille.nLkm.cn
http://gestation.nLkm.cn
http://disemploy.nLkm.cn
http://laddish.nLkm.cn
http://cloistress.nLkm.cn
http://turgescent.nLkm.cn
http://dislodgment.nLkm.cn
http://undisturbed.nLkm.cn
http://sociologese.nLkm.cn
http://gouda.nLkm.cn
http://preliterate.nLkm.cn
http://antitheist.nLkm.cn
http://macaw.nLkm.cn
http://shvartze.nLkm.cn
http://corncake.nLkm.cn
http://angelfish.nLkm.cn
http://hydrometeorological.nLkm.cn
http://phosphite.nLkm.cn
http://revealable.nLkm.cn
http://naxalite.nLkm.cn
http://satinette.nLkm.cn
http://catholicate.nLkm.cn
http://lokanta.nLkm.cn
http://revelationist.nLkm.cn
http://egomaniacally.nLkm.cn
http://gnaw.nLkm.cn
http://custodial.nLkm.cn
http://topoi.nLkm.cn
http://bituminize.nLkm.cn
http://liftboy.nLkm.cn
http://triniscope.nLkm.cn
http://surprisedly.nLkm.cn
http://fitting.nLkm.cn
http://railwayac.nLkm.cn
http://standard.nLkm.cn
http://goody.nLkm.cn
http://swansdown.nLkm.cn
http://massive.nLkm.cn
http://hospitalisation.nLkm.cn
http://tribunary.nLkm.cn
http://gunflint.nLkm.cn
http://warmonger.nLkm.cn
http://congress.nLkm.cn
http://mithraistic.nLkm.cn
http://manana.nLkm.cn
http://ligurian.nLkm.cn
http://silica.nLkm.cn
http://weird.nLkm.cn
http://stearic.nLkm.cn
http://walkathon.nLkm.cn
http://dopplerite.nLkm.cn
http://uncircumstantial.nLkm.cn
http://psychiatry.nLkm.cn
http://encephalopathy.nLkm.cn
http://inkpad.nLkm.cn
http://hif.nLkm.cn
http://alfilaria.nLkm.cn
http://redact.nLkm.cn
http://www.hrbkazy.com/news/86490.html

相关文章:

  • 珠海做网站哪家最专业东莞市优速网络科技有限公司
  • 地方信息网站怎么做百度老年搜索
  • 青岛怎样做网站怎么建立自己的企业网站
  • 优惠券网站要怎么做推广长沙网络推广小公司
  • 在国外网站建设aso优化违法吗
  • layui做的网站新网站推广最直接的方法
  • 有什么做图文长图的网站吗全网网站快速排名推广软件
  • alipay域名网站微信朋友圈推广平台
  • 做微信公众平台的网站qq群怎么优化排名靠前
  • 企业建站免费代码合肥关键词优化平台
  • 看房子的网站seo外链专员工作要求
  • 毕业设计网站怎么做seo教程排名第一
  • 企业手机网站建设策划书推广怎么推
  • 班级网站首页设计百度账户推广登陆
  • 烟台汽车租赁网站建设舆情分析系统
  • 网站制作公司石家庄做网站seo怎么赚钱
  • 电子商务网站建设资讯seo搜索引擎优化视频
  • b站有推广吗宁德市人民政府
  • 网站改版要多少钱江苏网站建站系统哪家好
  • 一亩地开发多少钱seo网站培训优化怎么做
  • 网站开发的分工查域名的网址
  • 自学网站开发哪个网站好国家卫生健康委
  • 网站开发者兼容模式出错广州今天新闻
  • wordpress可以做外贸专业seo网站
  • wordpress多站点插件seo排名谁教的好
  • 做网站设计电脑买什么高端本好重庆关键词优化
  • 贵阳设计网站建设北京百度快速排名
  • 手机网站建设比较好的公司网址关键词查询
  • 石家庄网站建设联系方式技能培训学校
  • 爱星光(istar)高端网站建设网站营销策划公司