当前位置:网站首页>redis中value/String
redis中value/String
2022-07-01 11:19:00 【每日一悟】
String
help set
nx是key值没有出现过,才可以进行设置(用于分布式锁)
xx是key必须出现过,才可以进行设置,相当于更新
mset可以设置多个key
mset k1 a k2 b
mget k1 k2
APPEND可以增加value的值
APPEND k1 "word"
get k1
GETRANGE从哪去到哪结束,并显示
GETRANGE k1 2 3
GETRANGE k1 2 -1 从2到最后一个
GETRANGE k1 2 -2 从2到倒数第二个
SETRANGE从哪到哪覆盖
SETRANGE k1 6 666 从第6个位置上覆盖666
STRLEN显示长度
STRLEN k1 显示k1长度
数值
type k1 查看k1的类型
OBJECT encoding k1
key中有type, 描述value的属性
key中有encoding,查看value编码
INCR k1 k1加一
INCRBY k1 value k1加value
DECR k1 k1减一
DECR k1 value k1减value
INCRBYFLOAT k1 0.5 k1加0.5
二进制安全
字符流
字节流
redis进程与外界做交互时,拿到的是字节流
redis-cli --raw
raw:如果不带raw,redis只会识别ascii,超过ascii,就会按十六进制显示,加上raw,会触发编码集的格式化
GETSET:将老值取出,新值插入
GETSET k1 666 返回k1原来的值
get k1 返回新值
MSETNX:只有k不存在的时候才能设置,可以设置多个key value
原则性操作:有一个添加失败,其余的都失败
bitmap位图
setbit key offset value:把key对应的value,第几个二进制位上的数变为value
offset是二进制位而非字节数组,是二进制的偏移量(1个字节有8个二进制位)
0 1 2 3 4 5 6 7 8 9 10 11 12
0-7代表第一个字节 8-16代表第二个字节
bitpos key bit [start] [end]:在规定字节索引范围内(start end),在key对应的value中,第一次二进制位上出现bit的位置
bitcount key [satrt end]: 在规定字节索引范围内(start end),在key对应的value中,统计1出现了几次
BIIOP operation destkey key [key...]:operation(and or xor not)返回的结果key key1与key2做operation操作
边栏推荐
- NeurIPS 2022 | 细胞图像分割竞赛正式启动!
- kubernetes之ingress探索实践
- No statements may be issued when any streaming result sets are open and in use on a given connection
- Neurips 2022 | cell image segmentation competition officially launched!
- 华泰证券网上开户安全吗?
- TEMPEST HDMI泄漏接收 4
- kafuka学习之路(一)kafuka安装和简单使用
- applyMiddleware 原理
- Mall applet source code open source version - two open
- Can servers bundled with flask be safely used in production- Is the server bundled with Flask safe to use in production?
猜你喜欢

applyMiddleware 原理

Global filter (processing time format)

田溯宁投的天润云上市:市值22亿港元 年利润下降75%

Applymiddleware principle

CVPR 2022 | Virtual Correspondence: Humans as a Cue for Extreme-View Geometry

Combinaison Oracle et json

华为设备配置大型网络WLAN基本业务

y48.第三章 Kubernetes从入门到精通 -- Pod的状态和探针(二一)

Numpy的矩阵

Introduction to unittest framework and the first demo
随机推荐
y48.第三章 Kubernetes从入门到精通 -- Pod的状态和探针(二一)
Google's new paper Minerva: solving quantitative reasoning problems with language models
In June 2022, it was the first programming language?!
Wechat applet development - user authorization to log in to "suggestions collection"
LeetCode. 515. Find the maximum value in each tree row___ BFS + DFS + BFS by layer
提问:测试工程师应该具备哪些职业素养?
【AI资讯月刊】350+资源大盘点!6月不容错过的资料和动态,都都都在这里啦!<附下载>
开发说,“ 这个不用测,回归正常流程就行 “,测试人员怎么办?
CANN算子:利用迭代器高效实现Tensor数据切割分块处理
获取键代码
技术分享 | Linkis参数介绍
openinstall:微信小程序跳转H5配置业务域名教程
Whether lending a bank card to others constitutes a crime
Matrix of numpy
2022年6月编程语言排行,第一名居然是它?!
Several cases of index failure
Neurips 2022 | cell image segmentation competition officially launched!
Personal mall two open Xiaoyao B2C mall system source code - Commercial Version / group shopping discount seckill source code
“目标检测”+“视觉理解”实现对输入图像的理解及翻译(附源代码)
The developer said, "this doesn't need to be tested, just return to the normal process". What about the testers?