Skip to main content
InterviewHubPRO
Section Overview
Q2

Question 2 of 50

Part 1: Basic & Foundational Concepts (Junior / Entry-Level)

4%
Redis & Caching (50 Qs)•Part 1: Basic & Foundational Concepts (Junior / Entry-Level)

What are the core Redis Data Structures and their primary use cases?

junior LevelCode ExampleredisBasic

In Simple Words:

  1. String: Basic text or binary blob up to 512 MB (caching JSON, session tokens, atomic integer counters with INCR).
  2. Hash: Key-value map representing an object (e.g. user profile attributes: name, email, age).
  3. List: Linked list of strings ordered by insertion (job queues, activity feeds with LPUSH/RPOP).
  4. Set: Unordered collection of unique strings (tagging, unique visitor tracking with SADD, SINTER).
  5. Sorted Set (ZSET): Unique elements ordered by a floating-point score (real-time leaderboards, rate limiters with ZADD, ZRANGEBYSCORE).
  6. Bitmap & HyperLogLog: Bit-level operations (daily active users) and probabilistic cardinality estimation with < 1% error using 12 KB of memory.
  7. Streams: Append-only log with consumer groups (event-driven messaging).
text
Redis Data Types Overview:
┌───────────────┬────────────────────────────┬─────────────────────────────┐
│ Type          │ Operations                 │ Typical Use Case            │
├───────────────┼────────────────────────────┼─────────────────────────────┤
│ String        │ SET, GET, INCR, DECR       │ Page Cache, Token Store     │
│ Hash          │ HSET, HGET, HGETALL        │ User Profiles, Session Data │
│ List          │ LPUSH, RPOP, BRPOP         │ Task Queues, Feeds          │
│ Set           │ SADD, SMEMBERS, SINTER     │ Unique Visitors, Follows    │
│ Sorted Set    │ ZADD, ZRANGE, ZREVRANK     │ Gaming Leaderboards, Sliders│
│ Stream        │ XADD, XREAD, XREADGROUP    │ Kafka-like Event Streams    │
└───────────────┴────────────────────────────┴─────────────────────────────┘