string

英[strɪŋ] 美[strɪŋ]

n.String; rope, belt; thread, plant fiber; [Computer Science] string

vt. Wind, tune; line up in a row or series; tie, tie or hang with a thread; extend or extend

Third person singular: strings Plural: strings Present participle: stringing past tense: strung past participle: strung

length

英[leŋθ] 美[leŋθ]

n.Length, long; time length; (speech) sound length; a paragraph, a section

Plural: lengths

redis STRLEN command syntax

Function: Returns the length of the string value stored in key. When key stores a value other than a string value, an error is returned.

Syntax: STRLEN key

Available versions: >= 2.2.0

Time complexity: O(1)

Returns: The length of the string value. When key does not exist, return 0.

redis STRLEN command example

# 获取字符串的长度
redis> SET mykey "Hello world"
OK
redis> STRLEN mykey
(integer) 11
# 不存在的 key 长度为 0
redis> STRLEN nonexisting
(integer) 0