STRLEN

Syntax

  1. STRLEN key

Time complexity: O(1)

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

Return

Integer reply: the length of the string at key, or 0 when key does not exist.

Examples

  1. dragonfly> SET mykey "Hello world"
  2. "OK"
  3. dragonfly> STRLEN mykey
  4. (integer) 11
  5. dragonfly> STRLEN nonexisting
  6. (integer) 0