当前位置:网站首页>Redis string 结构命令
Redis string 结构命令
2022-07-25 09:20:00 【yu-yuan】
字符串
//字符串类型存取
set key value (后加 xx 可以修改这个key的value)
get key
前值 输出 并替换成 value
getset key value
flushdb 清空当前数据库中的所有 keyKEY操作
| 查询已经存在的key | |
| 精确的查 | keys title |
| 模糊的查 | |
| *通配任意多个字符 | keys * |
| [ ]通配括号内的某一个字符 | keys titl[ey] |
| ?通配单个字符 | keys tit?e |
| 随机抽取一个key | random key |
| 查看这个key的类型 | type key |
| 判断某个key是否存在 | exists key |
| 删除这个key | del key |
| 更改key名(如果更改的新名字已经存在,继续改名会覆盖前一个key) | rename key newkey |
| 判断已存在key更改key name 不会影响已存在的key 值 | renamenx key neykey |
| 查询key的过期时间(已过期 -1 永不过期 -1) | ttl key (返回一个时间 m) |
| 设置 key 的有效时间 | expire key time (秒) pexpire key time (毫秒) pttl (以毫秒返回时间) persist key (永久有效) |
| 一次设置多个key | mset key1 value1 key2 value2 |
| 一次查询多个键 | mget key1 key2 key 3 |
| 替换字符串中的 某个 字符 | setrange key limit value 例如:name:redis setrange name 2 ! name:re!is 如果偏移下标不存在,会主动补充\x00 以字符 个数 补充 |
| 字符串追加 | append key @@ |
| 获取开始到结束的字符 | getrange key start shop
|
| 自增 | incr key incrby key 后加by (一次加自增多个) incebyfloat key (以浮点数增加) |
| 自减 | decr key decrby key 后加by (一次加自减多个) decrbyfloat key (以浮点数减少) |
| 位图 | setbit key offset(下标) value(1,0) offset 过大 则会在中间填充0 offset 最大 是 max offset 2的32次方减1 512M |
![]() | |
![]() | |
redis默认有16个数据库(默认使用的是database 0)
切换数据库
select ?
Redis string 可选参数
set key value ex (秒) px (毫秒)
ex px 都是可选参数 可以写可以不写
边栏推荐
- Detailed explanation of the use of nanny scanner class
- 如何将Jar包部署到服务器,注:启动命令有无nohup有很大关系
- Redis安装(Ubuntu)
- The interviewer asked: how to prevent oversold? There are several ways to achieve it
- ~4.1 剑指 Offer 05. 替换空格
- 深入理解static关键字
- Dynamically add multiple tabs and initialize each tab page
- 卷积神经网络的兴趣简单介绍
- 初始Flask以及简单地上手应用
- 什么是脑裂问题?
猜你喜欢
随机推荐
sqli-labs Basic Challenges Less11-22
深入理解static关键字
什么是单机、集群与分布式?
抽象类和接口的区别(最详细)
将list集合的某一字段拼接单个String
一文搞懂为什么要同时重写equals方法和hashCode方法+实例分析
PHP网站设计思路
C#语言和SQL Server数据库技术
Publish Yum private server using nexus3 (offline intranet)
BigDecimal 对数据进行四舍五入
What are stand-alone, cluster and distributed?
@2-1 CCF 2020-12-01 期末预测之安全指数
为什么要使用JSON.stringify()和JSON.parse()
【代码源】每日一题 非递减01序列
idea实用tips---如今将pom.xml(红色)改为pom.xml(蓝色)
What is the difference between mongodb and redis
Unable to start debugging on the web server, the web server failed to find the requested resource
作业7.21 约瑟夫环问题与进制转换
Click to hide the column in wechat applet, and then click to show it
js中map()函数的使用






![[GKCTF 2021]easynode](/img/f0/1daf6f83fea66fdefd55608cbddac6.png)

![[GYCTF2020]Ez_Express](/img/ce/02b90708f215715bb53cacfd4c21f0.png)

![[GYCTF2020]Node Game](/img/8d/7e6c2fb2a0359298fbcc1cd8544710.png)
![[De1CTF 2019]SSRF Me](/img/12/44c37cc713b49172a10579c9628c94.png)