当前位置:网站首页>Binary array command of redis
Binary array command of redis
2022-06-26 16:07:00 【Hua Weiyun】
redis Binary array command
redis The binary array of is in SDS To represent the ,sds Of len The value of the property represents SDS How many byte long bit groups are saved ,buf Each byte of the array is represented by a row , Each row 8 And the array is stored in reverse order
getbit command
getbit The command obviously returns the value of the binary bits of the specified offset of the bit array ,
redis> GETBIT bit 10086(integer) 1The execution process is to divide the offset by 8 The binary bits specified by the calculated offset are stored in the byte of the bit array , Then offset mod8 Add another one to calculate the number of bits in the binary system , Get the value of this bit and return
setbit command
setbit The command is to set a new value for the specified offset , And return the old value . If the offset is greater than the current one, it will be expanded
redis> SETBIT bit 10086 1(integer) 0bitcount command
bitcount The command is used to count the values in an array 1 The number of
redis> BITCOUNT bits(integer) 0redis> SETBIT bits 0 1 # 0001(integer) 0redis> BITCOUNT bits(integer) 1redis> SETBIT bits 3 1 # 1001(integer) 0redis> BITCOUNT bits(integer) 2bitcount Implementation of commands redis Table lookup method and Hamming algorithm are used , The number of binary bits is greater than or equal to 128 Bit uses Hamming Algorithm , Less than 128 Bit use look-up table .
bitop and Is to carry out and operate
bitop or To do or operate
bitop xor Is an XOR operation
bitop not Yes no operation
summary
This article mainly introduces redis Binary array of ,redis The binary array of SDS To express ,getbit Command returns the value of the binary bit of the specified offset of the bit array ,setbit The command sets a new value for the specified offset , And return the old value ,bitcount The command counts the values in the array as 1 The number of , When the number of binary bits is greater than or equal to 128 Bit using Hamming algorithm , Less than 128 Bit using the look-up table method ,bitop Command performs bit operations on binary arrays , It has various parameters ,and Representation and operation ,or To express or operate ,xor The XOR operation indicates ,not Indicates non operation , These commands are all commands that operate on binary arrays , Mastering binary array commands can make us more familiar with redis Binary array of .
️ Thank you for your
If you think this is helpful for you :
- Welcome to follow me ️, give the thumbs-up , Comment on , forward
- Focus on
Panpan small class, Push good articles for you regularly , There are also group chat and irregular lottery activities , You can say what you want , Communicate with the great gods , Learning together . - If there is anything inappropriate, you are welcome to criticize and correct .
边栏推荐
- redis的二进制数组命令
- Swiftui retrieves the missing list view animation
- Development, deployment and online process of NFT project (2)
- R语言使用cor函数计算相关性矩阵进行相关性分析,使用corrgram包可视化相关性矩阵、行和列使用主成分分析重新排序、下三角形中使用平滑的拟合线和置信椭圆,上三角形中使用散点图、对角线最小值和最大值
- Stepn débutant et avancé
- Lifeifei's team applied vit to the robot, increased the maximum speed of planning reasoning by 512 times, and also cued hekaiming's Mae
- Keepalived 实现 Redis AutoFailover (RedisHA)1
- Big talk Domain Driven Design -- presentation layer and others
- 精致妆容成露营“软实力”,唯品会户外美妆护肤产品销量激增
- js文本滚动分散动画js特效
猜你喜欢

NFT 项目的开发、部署、上线的流程(2)

NFT 平台安全指南(1)

Development, deployment and online process of NFT project (1)

NFT 平台安全指南(2)

Unlock the value of data fusion! Tencent angel powerfl won the "leading scientific and Technological Achievement Award" at the 2021 digital Expo

Ten thousand words! In depth analysis of the development trend of multi-party data collaborative application and privacy computing under the data security law

简单科普Ethereum的Transaction Input Data

Solana capacity expansion mechanism analysis (2): an extreme attempt to sacrifice availability for efficiency | catchervc research

NFT contract basic knowledge explanation

Svg canvas canvas drag
随机推荐
7 自定义损失函数
神经网络“炼丹炉”内部构造长啥样?牛津大学博士小姐姐用论文解读
Redis 迁移(操作流程建议)1
Solidus labs welcomes zhaojiali, former head of financial innovation in Hong Kong, as a strategic adviser
SAP OData development tutorial - from getting started to improving (including segw, rap and CDP)
mha 切换(操作流程建议)
若依打包如何分离jar包和资源文件?
redis的二进制数组命令
Svg canvas canvas drag
简单科普Ethereum的Transaction Input Data
Keepalived 实现 Redis AutoFailover (RedisHA)
3. Keras version model training
Svg savage animation code
NFT transaction principle analysis (2)
若依微服务特殊字符串被过滤的解决办法
R language plot visualization: plot visualizes the normalized histogram, adds the density curve KDE to the histogram, and uses geom at the bottom edge of the histogram_ Adding edge whisker graph with
11 cnn简介
5000 word analysis: the way of container security attack and defense in actual combat scenarios
Angel 3.2.0 new version released! Figure the computing power is strengthened again
Keepalived 实现 Redis AutoFailover (RedisHA)1