strlen.3valkey - Man Page

Returns the length of a string value.

Synopsis

STRLEN key

Description

Returns the length of the string value stored at key. An error is returned when key holds a non-string value.

Reply

valkey-protocol(7) Integer reply: the length of the string stored at key, or 0 when the key does not exist.

Complexity

O(1)

Acl Categories

@fast @read @string

History

Examples

127.0.0.1:6379> SET mykey "Hello world"
OK
127.0.0.1:6379> STRLEN mykey
(integer) 11
127.0.0.1:6379> STRLEN nonexisting
(integer) 0

See Also

append(3valkey), decr(3valkey), decrby(3valkey), get(3valkey), getdel(3valkey), getex(3valkey), getrange(3valkey), incr(3valkey), incrby(3valkey), incrbyfloat(3valkey), lcs(3valkey), mget(3valkey), mset(3valkey), msetnx(3valkey), set(3valkey), setrange(3valkey)

Referenced By

lber-types(3), memchr(3), OSSL_PARAM_int.3ossl(3), pmfstring(3), regex(3), signal-safety(7), strchr(3), str_copy(3), str_diff(3), str_diffn(3), str_equal(3), string(3), str_len(3), strnlen(3), waffle_error(3), wcslen(3).

2024-09-23 8.0.0 Valkey Command Manual