STRLEN

Synopsis

STRLEN keyThis command finds the length of the string value that is associated with the given key.

  • If key is associated with a non-string value, an error is raised.
  • If key does not exist, 0 is returned.

Return value

Returns length of the specified string.

Examples

  1. $ SET yugakey "string value"
  1. "OK"
  1. $ STRLEN yugakey
  1. 12
  1. $ STRLEN undefined_key
  1. 0

See also

append, get, getrange, getset, incr, incrby, set, setrange