Advertisement
Beginner Redis, Redis CLI & Basic Commands

What do the basic SET, GET, and DEL commands do in Redis?

Short answer

SET stores a value under a specified key, GET retrieves the current value stored under a specified key, and DEL removes one or more keys entirely from Redis, together forming the fundamental building blocks for storing, retrieving, and removing simple data.

Save Redis mock interview
Advertisement
AModel answer
SET stores a value under a specified key, GET retrieves the current value stored under a specified key, and DEL removes one or more keys entirely from Redis, together forming the fundamental building blocks for storing, retrieving, and removing simple data.
Example

SET username 'alice' GET username DEL username

Real-world example
A simple caching layer uses SET to store a computed result, GET to quickly retrieve it on subsequent requests, and DEL to remove it once it is no longer needed or has become outdated.
Likely follow-ups
  • What does GET return if the requested key does not exist?
  • Can DEL remove multiple keys in a single command call?
Related topics