Script Valley
Redis: Complete Course
Redis Fundamentals/Assessment

Practice & Assessment

Test your understanding of Redis Fundamentals

Multiple Choice Questions

5
1

What does the TTL command return when a key exists but has no expiry set?

2

Which Redis data type maintains members in order by a numeric score?

3

Which persistence mode offers the highest durability at the cost of write throughput?

4

What is the maximum size of a single String value in Redis?

5

Which command removes the TTL from a key without deleting it?

Coding Challenges

1
1

Session Store with Expiry

Using redis-cli or any Redis client library, create a function that stores a session token as a Redis String under the key pattern session:<token>, sets a TTL of 30 minutes, and returns the remaining TTL in seconds. Input: a string token and a user ID. Output: the TTL in seconds immediately after setting. Verify with TTL command. Estimated time: 15 minutes.

Easy

Mini Project

1

Redis-Backed User Profile Cache

Build a small Node.js or Python script that reads a user object (id, name, email, age) from a plain JSON file, stores it in Redis as a Hash under user:<id>, sets a 5-minute TTL, and exposes two functions: getUser(id) — returns the hash from Redis if present, else re-reads from JSON and repopulates; deleteUser(id) — removes the key. Log whether each getUser call was a cache hit or miss. Use HSET, HGETALL, EXPIRE, and DEL. Demonstrate RDB persistence by stopping and restarting the Redis server and confirming the data survives if saved within the snapshot window.

Easy