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://www.codercto.com/courses/l/33.html

查看所有标签

Remote

Remote

Jason Fried、David Heinemeier Hansson / Crown Business / 2013-10-29 / CAD 26.95

The “work from home” phenomenon is thoroughly explored in this illuminating new book from bestselling 37signals founders Fried and Hansson, who point to the surging trend of employees working from hom......一起来看看 《Remote》 这本书的介绍吧!

SHA 加密
SHA 加密

SHA 加密工具

XML、JSON 在线转换
XML、JSON 在线转换

在线XML、JSON转换工具

Markdown 在线编辑器
Markdown 在线编辑器

Markdown 在线编辑器