当前位置:网站首页>redis的bitmap能设置最大的长度是多少, 为什么可以设置的最大长度位数是2^32, 怎么计算bitmap会占用多大的空间
redis的bitmap能设置最大的长度是多少, 为什么可以设置的最大长度位数是2^32, 怎么计算bitmap会占用多大的空间
2022-04-21 07:58:00 【Day____Day____Up】
前提: 实际上, redis只支持5种数据类型. 并没有bitmap. 也就是bitmap是基于redis的字符串类型的. 而一个字符串类型最多存储512M.
首先: 计算机的单位换算先了解下
8 bit = 1byte
1024 byte = 1kb
1024 kb = 1Mb
其次:
我们使用的bitmap指令SETBIT key offset value, 这个指令就是将第offset设置成0或1. 比如 SETBIT ss 1000 1 //就是将1000位置为1. 1 bit就是1位, 所以我们只要将512M换算成bit, 那么就知道bitmap支持的最大设置长度了. 计算如下
8 * 1024 * 1024 * 512 = 2^32 (所以这个结果就是这么来的)
怎么计算自己的bitmap会大概占用多大的存储空间呢?
举个栗子: 今有一个bitmap最大长度1024, 需要占用多大的空间?
解: 长度1024也就是他需要1024个位(bit), 或者单位为byte就是需要 1024 / 8, 即需要128byte
版权声明
本文为[Day____Day____Up]所创,转载请带上原文链接,感谢
https://blog.csdn.net/weixin_37281289/article/details/106834014
边栏推荐
- PIP was installed successfully, but pycharm reported an error
- docker怎么访问宿主中redis服务6379端口
- Echart double line - echart chart (II)
- 统计链表个数及查找链表
- 22年4月刷题总结
- Xiaomi router 3G R3G brushes in the records of feed and openwrt 20.02.2
- Arm64 architecture programming and practice: arithmetic and shift instructions
- 什么是父子关系和菱形继承
- Multi classification logistic regression judgment of three classification iris
- Select tab selected dynamic query of selected status
猜你喜欢

【C语言入门系列(8)(9)】第八、九章、指针、结构体

Web rotation

Redis (15) -- master-slave replication of redis -- sentinel mode

配置多个ssh-key

visio设置网络拓扑图

【读书笔记->统计学】07-01 离散型概率分布-几何分布概念简介

Prometheus 基础知识脑图

Add a cute girl to your website
![[talkative cloud native] load balancing - the passenger flow of small restaurants has increased](/img/55/cc2adf83a86718b634598c4463fcd1.png)
[talkative cloud native] load balancing - the passenger flow of small restaurants has increased

HTTP cache policy and scheme
随机推荐
ARM64体系结构编程与实践:算术与移位指令
pip安装成功,但是pycharm报错的问题
给自己的网站添加一个可爱的妹子
PbIdea 如何导入医保大文件
Thinkphp快速入门(三)
Introduction to cyberspace and implementation of cryptography operation
How pbidea imports large medical insurance files
最近发现百度云分享都要设置有提取码, 无法设置为无提取码的分享.本文将教你怎么绕过百度设置无提取码的分享(即公开的), 一行代码搞定!
Add a cute girl to your website
[introduction to C language series (8) (9)] Chapter 8 and 9, pointer and structure
第六章 关联查询
Servlet生命周期
autojs自动化脚本怎么在电脑上开发, 详细的靠谱教程!!!
第八章 事务
Redis(15) -- Redis的主从复制--哨兵模式
记C#的操蛋字符串转Base64和Base64还原字符串
PIP was installed successfully, but pycharm reported an error
31省份及直辖市自治区的下拉框代码
在链表结点前插入新结点
大家在深圳的一天是怎样度过的呢?