Introduction
Strings in Redis are the simplest type because they store plain text or binary data directly. They are easy to use and fast to read or write.
Strings in Redis are the simplest type because they store plain text or binary data directly. They are easy to use and fast to read or write.
SET key value GET key
SET stores a string value under a key.
GET retrieves the string value stored at a key.
SET greeting "Hello, Redis!"
GET greetingSET counter 100
GET counterSET flag true GET flag
This example saves the string "blue" under the key "favorite_color" and then gets it back.
SET favorite_color blue GET favorite_color
Strings in Redis can hold any data up to 512 MB in size.
Even numbers are stored as strings, so you can use string commands or numeric commands on them.
Redis strings are simple and store plain text or binary data.
They are easy to set and get with simple commands.
Strings are useful for many common tasks like caching and counting.
SET count 10 INCR count GET count
SET user "Alice" INCR user GET user
Pass the test and this pattern moves unknown