当前位置:网站首页>12_ Redis_ Bitmap_ command
12_ Redis_ Bitmap_ command
2022-07-02 15:20:00 【Listen to the rain】
Bitmap
Bit storage
Statistics user information , active , Inactive ! Sign in 、 Not logged in ! Clock in ,365 Clock in ! Two states of , You can use Bitmap !
Bitmap Bitmap , data structure ! It's all operating bits to record , Only 0 and 1 Two states !
Use bitmap To record clocks from Monday to Sunday !
Monday ∶1 Tuesday ∶0 Wednesday :0 Thursday :1 Friday :0 Saturday :1 Sunday :0
127.0.0.1:6379> setbit sign 0 1 // Set the daily clock in situation
(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 // Check whether you punch in on Thursday !
(integer) 1
127.0.0.1:6379> getbit sign 6
(integer) 0
127.0.0.1:6379> bitcount sign // Count the days of clocking in a week !
(integer) 3
边栏推荐
猜你喜欢
随机推荐
MFC 控制台打印,弹出对话框
[solution] educational codeforces round 82
Practice of compiling principle course -- implementing an interpreter or compiler of elementary function operation language
Leetcode - Search 2D matrix
实用调试技巧
哈夫曼树:(1)输入各字符及其权值(2)构造哈夫曼树(3)进行哈夫曼编码(4)查找HC[i],得到各字符的哈夫曼编码
[noi simulation] Elis (greedy, simulation)
TiDB数据迁移场景综述
TiDB混合部署拓扑
MFC A对话框调用B对话框函数并传参
[noi Simulation Competition] scraping (dynamic planning)
Application of CDN in game field
Internet Explorer officially retired
LeetCode 2320. Count the number of ways to place the house
14_Redis_乐观锁
Huawei interview question: no palindrome string
Introduction to mathjax (web display of mathematical formulas, vector)
C RichTextBox controls the maximum number of lines displayed
List set & UML diagram
How does the computer set up speakers to play microphone sound