当前位置:网站首页>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
边栏推荐
- CodeCraft-22 and Codeforces Round #795 (Div. 2)D,E
- Map介绍
- GeoServer offline map service construction and layer Publishing
- 可视化搭建页面工具的前世今生
- Huawei interview question: no palindrome string
- 使用 TiUP 部署 TiDB 集群
- Key points of compilation principle examination in 2021-2022 academic year [overseas Chinese University]
- 哈夫曼树:(1)输入各字符及其权值(2)构造哈夫曼树(3)进行哈夫曼编码(4)查找HC[i],得到各字符的哈夫曼编码
- Mavn builds nexus private server
- forEach的错误用法,你都学废了吗
猜你喜欢

02_线性表_顺序表

LeetCode 2320. Count the number of ways to place the house

可视化搭建页面工具的前世今生

CodeCraft-22 and Codeforces Round #795 (Div. 2)D,E
![[untitled] leetcode 2321 Maximum score of concatenated array](/img/a3/54d0e83f02ef0d0d8d269351c35b39.png)
[untitled] leetcode 2321 Maximum score of concatenated array

Learn the method code example of converting timestamp to uppercase date using PHP

LeetCode 2310. The number of digits is the sum of integers of K

MFC timer usage

Base64 coding can be understood this way

蜻蜓低代码安全工具平台开发之路
随机推荐
【C语言】详解指针的初阶和进阶以及注意点(1)
Arithmetic operations and related exercises in C language
How to write sensor data into computer database
16_Redis_Redis持久化
XML配置文件
forEach的错误用法,你都学废了吗
08_ strand
Solve the problem that El radio group cannot be edited after echo
04_ 栈
學習使用php實現公曆農曆轉換的方法代碼
LeetCode 2320. Count the number of ways to place the house
07_哈希
C语言习题---(数组)
Introduction to C language -- array
MFC CString to char*
[noi simulation] Elis (greedy, simulation)
C language exercises - (array)
MFC 定时器使用
About text selection in web pages and counting the length of selected text
记一次面试