英[??bd??kt] US[?ɑ:bd?ekt]

##n.Object; target; object; object, object

vi.Disapprove, oppose; feel disgusted

vt. Reasons for objection

Third person singular: objects Plural: objects Present participle: objecting Past tense: objected Past participle: objected

redis OBJECT command syntax

Function: The OBJECT command allows viewing the Redis object of a given key from within.

Syntax: OBJECT subcommand [arguments [arguments]]

Description: It is usually used for debugging or understanding in order to save space And the case of using special encoding for key. When using Redis as a cache program, you can also determine key eviction policies through the information in the OBJECT command.

Available versions: >= 2.2.3

Time complexity: O(1)

Returns: REFCOUNT and IDLETIME return numbers. ENCODING returns the corresponding encoding type.

redis OBJECT command example

redis> SET game "COD"           # 設(shè)置一個字符串
OK
redis> OBJECT REFCOUNT game     # 只有一個引用
(integer) 1
redis> OBJECT IDLETIME game     # 等待一陣。。。然后查看空轉(zhuǎn)時間
(integer) 90
redis> GET game                 # 提取game, 讓它處于活躍(active)狀態(tài)
"COD"
redis> OBJECT IDLETIME game     # 不再處于空轉(zhuǎn)
(integer) 0
redis> OBJECT ENCODING game     # 字符串的編碼方式
"raw"
redis> SET phone 15820123123    # 大的數(shù)字也被編碼為字符串
OK
redis> OBJECT ENCODING phone
"raw"
redis> SET age 20               # 短數(shù)字被編碼為 int
OK
redis> OBJECT ENCODING age
"int"