Redis Data Types

Redis Data Types

Redis has these data types:

  • Binary-safe strings
  • Lists
  • Sets
  • Sorted sets
  • Hashes
  • Bit arrays
  • HyperLogLogs

Here, we briefly explain each of these.

(This tutorial is part of our Redis Guide. Use the right-hand menu to navigate.)

Redis keys

The first element of any Redis data structure is a key. One notable difference with Redis than other systems is that they you can set keys to expire after a certain amount of time.

The keys are binary safe, meaning you can use any kind of pattern of characters, even those that cannot be rendered on the screen, like a JPEG image.

The Redis style guide recommends to use colons (:) to give some meaning to keys like sports:balls:tennisball.

Strings

Strings are just strings. Strings are numbers too, like floats, meaning there is no separate float or integer data type.

set mystrng strivalue
OK
localhost:7001> get mystrng
"strivalue"
David Miller
Author

David Miller

David Miller brings 15 years of experience in global economics, personal finance strategy, and market dynamics. He specializes in turning complex economic trends into actionable insights for everyday readers.