当前位置:网站首页>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
边栏推荐
- Kibana basic operation
- Record an error report, solve the experience, rely on repetition
- Common English abbreviations for data analysis (I)
- AtCoder Beginner Contest 254
- 【C语言】详解指针的初阶和进阶以及注意点(1)
- Learn the method code example of converting timestamp to uppercase date using PHP
- 13_Redis_事务
- geoserver离线地图服务搭建和图层发布
- Arithmetic operations and related exercises in C language
- btrace-(字节码)动态跟踪工具
猜你喜欢

05_队列

18_Redis_Redis主从复制&&集群搭建

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

vChain: Enabling Verifiable Boolean Range Queries over Blockchain Databases(sigmod‘2019)

Application and practice of Jenkins pipeline

07_哈希

【C语音】详解指针进阶和注意点(2)

搭载TI AM62x处理器,飞凌FET6254-C核心板首发上市!

XML Configuration File

MFC timer usage
随机推荐
Solution of Queen n problem
数据分析思维分析方法和业务知识——业务指标
MFC A对话框调用B对话框函数并传参
Tidb data migration scenario overview
06_栈和队列转换
Learn the method code of using PHP to realize the conversion of Gregorian calendar and lunar calendar
13_Redis_事务
C语言实现N皇后问题
C language exercises - (array)
C thread transfer parameters
04_ Stack
17_Redis_Redis发布订阅
学习使用php将时间戳转换为大写日期的方法代码示例
Apprendre le Code de la méthode de conversion du calendrier lunaire grégorien en utilisant PHP
传感器数据怎么写入电脑数据库
04_ 栈
[noi simulation] Elis (greedy, simulation)
The past and present lives of visual page building tools
02_ Linear table_ Sequence table
TiDB数据迁移场景综述