What are Redis Functions (replacing Lua scripts in Redis 7+)?
Answer
Redis Functions, introduced in Redis 7.0, replace the EVAL-based Lua scripting model with a more robust, library-oriented approach. With EVAL, scripts are loaded and executed per-request, requiring the script body or its SHA to be sent each time. Functions are persistent: you upload a named library with FUNCTION LOAD, and the functions persist across restarts (stored in the RDB/AOF). You call them with FCALL function_name numkeys keys args. Functions support multiple entry points in one library, versioning, and metadata. They currently support Lua (the default engine) with a planned JavaScript engine. The key advantages over EVAL: functions are first-class entities with names and documentation, they survive restart without re-uploading, and they integrate with RDB/AOF persistence. Redis encourages migration from EVAL-based scripts to Functions for all production use cases.
Previous
How does AOF rewrite work and how does it compare to RDB performance?
Next
What is Redis Stack and what does it add to vanilla Redis?
More Redis Questions
View all →- Advanced How does Redis Cluster sharding and the hash slot algorithm work in detail?
- Advanced What is consistent hashing and how does it compare to Redis Cluster's approach?
- Advanced What is memory optimization in Redis (ziplist, listpack, and encoding thresholds)?
- Advanced How does AOF rewrite work and how does it compare to RDB performance?
- Advanced What is Redis Stack and what does it add to vanilla Redis?