当前位置:网站首页>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
边栏推荐
- LeetCode 209. 长度最小的子数组
- Tidb environment and system configuration check
- AtCoder Beginner Contest 254
- Printf function and scanf function in C language
- Practice of compiling principle course -- implementing an interpreter or compiler of elementary function operation language
- Why can't programmers who can only program become excellent developers?
- Learn the method code of using PHP to realize the conversion of Gregorian calendar and lunar calendar
- 18_Redis_Redis主从复制&&集群搭建
- 19_Redis_宕机后手动配置主机
- 实用调试技巧
猜你喜欢

07_哈希
![[c voice] explain the advanced pointer and points for attention (2)](/img/fb/515e25899bd9a2905ee63cb041934a.png)
[c voice] explain the advanced pointer and points for attention (2)
![[untitled] leetcode 2321 Maximum score of concatenated array](/img/a3/54d0e83f02ef0d0d8d269351c35b39.png)
[untitled] leetcode 2321 Maximum score of concatenated array

kibana 基础操作

JMeter script parameterization

关于网页中的文本选择以及统计选中文本长度

为什么只会编程的程序员无法成为优秀的开发者?

Mavn builds nexus private server

Kityformula editor configure font size and spacing

MFC timer usage
随机推荐
C# 线程传参
Have you learned the wrong usage of foreach
Sharp tool SPL for post SQL calculation
MathML to latex
为什么只会编程的程序员无法成为优秀的开发者?
编译原理课程实践——实现一个初等函数运算语言的解释器或编译器
871. Minimum refueling times: simple priority queue (heap) greedy question
C language exercises - (array)
MFC timer usage
Practice of compiling principle course -- implementing an interpreter or compiler of elementary function operation language
學習使用php實現公曆農曆轉換的方法代碼
C#代码审计实战+前置知识
AtCoder Beginner Contest 254
Topology architecture of the minimum deployment of tidb cluster
btrace-(字节码)动态跟踪工具
XML配置文件
学习使用php将时间戳转换为大写日期的方法代码示例
哈夫曼树:(1)输入各字符及其权值(2)构造哈夫曼树(3)进行哈夫曼编码(4)查找HC[i],得到各字符的哈夫曼编码
TiDB 集群最小部署的拓扑架构
kibana 基础操作