Redis Getbit 命令

Redis 教程 · 2019-03-06 22:41:31

Redis Getbit 命令用于对 key 所储存的字符串值,获取指定偏移量上的位(bit)。

语法

redis Getbit 命令基本语法如下:

redis 127.0.0.1:6379> GETBIT KEY_NAME OFFSET

可用版本

>= 2.2.0

返回值

字符串值指定偏移量上的位(bit)。

当偏移量 OFFSET 比字符串值的长度大,或者 key 不存在时,返回 0 。

实例

# 对不存在的 key 或者不存在的 offset 进行 GETBIT, 返回 0

redis> EXISTS bit
(integer) 0

redis> GETBIT bit 10086
(integer) 0


# 对已存在的 offset 进行 GETBIT

redis> SETBIT bit 10086 1
(integer) 0

redis> GETBIT bit 10086
(integer) 1

点击查看所有 Redis 教程 文章: https://codercto.com/courses/l/33.html

查看所有标签

The Art and Science of Java

The Art and Science of Java

Eric Roberts / Addison-Wesley / 2007-3-1 / USD 121.60

In The Art and Science of Java, Stanford professor and well-known leader in CS Education Eric Roberts emphasizes the student-friendly exposition that led to the success of The Art and Science of C. By......一起来看看 《The Art and Science of Java》 这本书的介绍吧!

HTML 编码/解码
HTML 编码/解码

HTML 编码/解码

MD5 加密
MD5 加密

MD5 加密工具

html转js在线工具
html转js在线工具

html转js在线工具