Challenge - 5 Problems
Script Caching Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ query_result
intermediate2:00remaining
Output of SCRIPT LOAD command
What does the
SCRIPT LOAD command return when you load a Lua script into Redis?Redis
SCRIPT LOAD "return redis.call('PING')"Attempts:
2 left
💡 Hint
Think about what Redis returns to identify a script uniquely after loading.
✗ Incorrect
SCRIPT LOAD returns the SHA1 hash of the script, which can be used later to execute the script by reference.
❓ query_result
intermediate2:00remaining
Result of EVALSHA with missing script
What happens when you run
EVALSHA with a SHA1 hash that is not loaded in Redis?Redis
EVALSHA <nonexistent_sha1> 0Attempts:
2 left
💡 Hint
Consider what Redis does if the script hash is unknown.
✗ Incorrect
If the script SHA1 is not found in Redis cache, EVALSHA returns a NOSCRIPT error.
📝 Syntax
advanced2:00remaining
Identify the correct SCRIPT FLUSH usage
Which of the following commands correctly flushes all cached Lua scripts in Redis?
Attempts:
2 left
💡 Hint
Check the official Redis command for clearing scripts.
✗ Incorrect
SCRIPT FLUSH clears all cached scripts from Redis memory.
❓ optimization
advanced2:00remaining
Best practice for script execution performance
To optimize performance when running the same Lua script multiple times in Redis, which approach is best?
Attempts:
2 left
💡 Hint
Think about how Redis caches scripts and how to reuse them efficiently.
✗ Incorrect
Loading the script once and running it by SHA1 hash avoids repeated parsing and improves performance.
🧠 Conceptual
expert2:00remaining
Understanding script caching behavior on Redis restart
What happens to cached Lua scripts in Redis after a server restart?
Attempts:
2 left
💡 Hint
Consider Redis memory and persistence behavior for scripts.
✗ Incorrect
Cached scripts are stored in memory only and are lost on restart; they must be reloaded.