Actions41
- Append
- Blocking Pop Left
- Blocking Pop Right
- Delete
- Eval
- Exists
- Expire At
- Get
- Get Set
- Hash Exists
- Hash Get
- Hash Keys
- Hash Length
- Hash Set
- Hash Values
- Increment
- Info
- Keys
- List Length
- List Range
- Multi Get
- Multi Hash Get
- Multi Mix Get
- Multi Mix Set
- Multi Set
- Persist
- Pop
- Publish
- Push
- Scan
- Set
- Set Add
- Set Cardinality
- Set Is Member
- Set Remove
- Sorted Set Add
- Sorted Set Cardinality
- Sorted Set Range
- Sorted Set Remove
- String Length
- TTL
Overview
The node "Redis Enhanced" provides a comprehensive interface to interact with a Redis database, supporting a wide range of Redis operations including data retrieval, modification, and management. The eval operation specifically allows users to execute custom Lua scripts on the Redis server, enabling advanced and flexible data manipulation beyond standard commands.
This node is beneficial in scenarios where complex Redis transactions or atomic operations are required that cannot be easily achieved with simple Redis commands. For example, you might use the eval operation to perform multi-key operations atomically, implement custom logic for data processing, or extend Redis functionality with Lua scripting.
Practical examples:
- Running a Lua script to increment multiple keys conditionally.
- Executing a script that performs complex calculations or data transformations on Redis data.
- Implementing custom locking mechanisms or counters using Lua scripts.
Properties
| Name | Meaning |
|---|---|
| Script | The Lua script code to execute on the Redis server. |
| Keys | Space-separated list of Redis keys to pass as input to the Lua script. |
| Arguments | Space-separated list of arguments to pass to the Lua script (beyond the keys). |
| Value Is JSON | (Shown only if key type is hash) Whether the value is JSON or key-value pairs (not used in eval but part of node properties). |
Output
The output JSON contains a single property:
result: The result returned by the executed Lua script. This can be any valid Redis response type converted appropriately. If the result is a bigint, it is converted to a number.
Example output JSON:
{
"result": <value_returned_by_lua_script>
}
The node does not output binary data for the eval operation.
Dependencies
- Requires a connection to a Redis instance.
- Needs an API key credential or equivalent authentication configured in n8n to connect to Redis.
- Uses the Redis client library internally to communicate with the Redis server.
- The user must provide valid Lua scripts compatible with Redis's Lua scripting environment.
Troubleshooting
Common issues:
- Syntax errors in the Lua script will cause execution failure.
- Passing incorrect keys or arguments format may lead to unexpected results or errors.
- Connection issues with Redis server (wrong credentials, network problems).
- Large or long-running scripts may time out or impact Redis performance.
Error messages:
- Errors thrown during script execution will be reported with the error message from Redis or the Lua interpreter.
- If the Lua script contains invalid JSON parsing or other runtime errors, the node will throw an error indicating the problem.
- If the key or argument parameters are malformed, the node may throw an error about invalid input.
How to resolve:
- Validate Lua script syntax before running.
- Ensure keys and arguments are space-separated strings without extra whitespace.
- Verify Redis connection credentials and network accessibility.
- Use smaller or optimized Lua scripts to avoid performance issues.
- Enable "Continue On Fail" option in the node settings to handle errors gracefully during batch executions.