当前位置:网站首页>12_Redis_Bitmap_命令
12_Redis_Bitmap_命令
2022-07-02 12:00:00 【听*雨声】
Bitmap
位存储
统计用户信息,活跃,不活跃!登录、未登录!打卡,365打卡!两个状态的,都可以使用Bitmap !
Bitmap位图,数据结构!都是操作二进制位来进行记录,就只有0和1两个状态!
使用bitmap来记录周一到周日的打卡!
周一∶1 周二∶0 周三:0 周四:1 周五:0 周六:1 周天:0
127.0.0.1:6379> setbit sign 0 1 // 设置每天打卡的情况
(integer) 0
127.0.0.1:6379> setbit sign 1 0
(integer) 0
127.0.0.1:6379> setbit sign 2 0
(integer) 0
127.0.0.1:6379> setbit sign 3 1
(integer) 0
127.0.0.1:6379> setbit sign 4 0
(integer) 0
127.0.0.1:6379> setbit sign 5 1
(integer) 0
127.0.0.1:6379> setbit sign 6 0
(integer) 0
127.0.0.1:6379> getbit sign 3 // 查看星期四是否有打卡!
(integer) 1
127.0.0.1:6379> getbit sign 6
(integer) 0
127.0.0.1:6379> bitcount sign // 统计一周打卡的天数!
(integer) 3
边栏推荐
猜你喜欢
随机推荐
IE 浏览器正式退休
871. 最低加油次数 : 简单优先队列(堆)贪心题
PHP method to get the index value of the array item with the largest key value in the array
Record an interview
C # delay, start the timer in the thread, and obtain the system time
Practice of compiling principle course -- implementing an interpreter or compiler of elementary function operation language
TiDB 软件和硬件环境建议配置
04_ 栈
About text selection in web pages and counting the length of selected text
[development environment] install the visual studio community 2013 development environment (download the installation package of visual studio community 2013 with update 5 version)
【C语音】详解指针进阶和注意点(2)
【NOI模拟赛】伊莉斯elis(贪心,模拟)
17_Redis_Redis发布订阅
MFC 控制台打印,弹出对话框
Learn the method code example of converting timestamp to uppercase date using PHP
Introduction to C language -- array
华为面试题: 没有回文串
LeetCode_滑动窗口_中等_395.至少有 K 个重复字符的最长子串
Leetcode - Search 2D matrix
LeetCode 209. 长度最小的子数组









