Redis functions are here!
Blog post from Upstash
Upstash Redis SDK now supports Redis Functions, allowing users to write and store custom Lua scripts directly in Redis, enabling more efficient execution by loading a function once and calling it by name rather than using EVAL each time. Redis Functions are managed server-side and persist until explicitly removed, providing a more streamlined way to handle reusable logic. The SDK introduces a new namespace, redis.functions, with methods such as load(), call(), callRo(), list(), stats(), delete(), and flush(), which facilitate function management and interaction. For functions that only read data, adding a no-writes flag improves performance by enabling execution in read-only contexts and using callRo(), which is optimized for such operations. This new approach offers a cleaner, more organized method for implementing and reusing Lua script logic within Redis.