Advertisement
Beginner Redis, Strings & Bitmaps in Redis

What is the Redis string data type, and what kinds of values can it actually store?

Short answer

A Redis string can store text, numbers, or even binary data up to five hundred twelve megabytes in size, making it the most basic and flexible data type in Redis, commonly used for simple values like a session token, a cached page, a counter, or a serialized object.

Save Redis mock interview
Advertisement
AModel answer
A Redis string can store text, numbers, or even binary data up to five hundred twelve megabytes in size, making it the most basic and flexible data type in Redis, commonly used for simple values like a session token, a cached page, a counter, or a serialized object.
Example

SET greeting 'Hello, World!' SET user_count 100 GET greeting

Real-world example
A simple page view counter stores its current count as a Redis string, incrementing it every time a visitor loads the page.
Likely follow-ups
  • What is the maximum size limit for a single Redis string value?
  • Can a Redis string store binary data like an image?
Related topics