当前位置:网站首页>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操作
边栏推荐
- Can I open an account today and buy stocks today? Is it safe to open an account online?
- 谷歌新论文-Minerva:用语言模型解决定量推理问题
- Ultra detailed black apple installation graphic tutorial sent to EFI configuration collection and system
- MIT's latest paper, "the need for interpretable features: motivation and classification": building interpretability in the constituent elements of machine learning models
- Mysql的四个隔离级别是如何实现的 (简要)
- Intel Labs annonce de nouveaux progrès en photonique intégrée
- Value 1000 graduation project campus information publishing platform website source code
- Personal mall two open Xiaoyao B2C mall system source code - Commercial Version / group shopping discount seckill source code
- Skip the test cases to be executed in the unittest framework
- The developer said, "this doesn't need to be tested, just return to the normal process". What about the testers?
猜你喜欢
CVPR 2022 | 基于密度与深度分解的自增强非成对图像去雾
Oneconnect plans to be listed in Hong Kong on July 4: a loss of nearly 3 billion in two years, with a market capitalization evaporation of more than 90%
Neurips 2022 | cell image segmentation competition officially launched!
Brief analysis of edgedb architecture
Wonderful! MarkBERT
CVPR22 |CMT:CNN和Transformer的高效结合(开源)
Oracle和JSON的結合
Jd.com renewed its cooperation with Tencent: issuing class A shares to Tencent with a maximum value of US $220million
Face detection and recognition system based on mtcnn+facenet
Value 1000 graduation project campus information publishing platform website source code
随机推荐
8款最佳实践,保护你的 IaC 安全!
Openinstall: wechat applet jump to H5 configuration service domain name tutorial
Whether lending a bank card to others constitutes a crime
8 best practices to protect your IAC security!
Give up high paying jobs in Shenzhen and go back home
TEMPEST HDMI泄漏接收 3
flutter path_ Provider: ^2.0.10 can get temporary directory
sshd_config 中 PermitRootLogin 的探讨
Mingchuang plans to be listed on July 13: the highest issue price is HK $22.1, and the net profit in a single quarter decreases by 19%
Continuous delivery -pipeline getting started
Database experiment report (II)
Several cases of index failure
Skip the test cases to be executed in the unittest framework
Introduction to unittest framework and the first demo
Spam filtering challenges
微信小程序开发 – 用户授权登陆「建议收藏」
证券账户销户后果 开户安全吗
Huawei Equipment configure les services de base du réseau WLAN à grande échelle
Exposure:A White-Box Photo Post-Processing Framework阅读札记
编译调试Net6源码