Redis Data Structures
Redis is often called a "Data Structure Store". Understanding how these structures are represented in memory is key to writing efficient applications.
Strings Data Model
Strings
The most basic Redis type. Can contain any data, up to 512MB.
int
embstr
raw
Engine Insights
Redis automatically optimizes memory by switching between these encodings as your data grows. This "Lazy Optimization" ensures both speed and memory efficiency.
Internal Representation
Live Preview
user:100:name
string
Internal Encoding
embstr
Memory Usage
56 bytes
Value Content
"Alice Smith"
user:100:visits
string
Internal Encoding
int
Memory Usage
32 bytes
Value Content
42
Observe how the "Encoding" field changes based on the value. In Redis, integers are often stored in binary to save space, while small strings use the "Embedded String" optimization.