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 string manipulation, list handling, set operations, hash management, sorted sets, key scanning, and Lua script execution. It is designed for users who want to get, send, update, or manage data in Redis with enhanced capabilities beyond basic commands.
This node is beneficial in scenarios such as:
- Managing caching layers by setting and retrieving keys.
- Handling real-time messaging via Redis Pub/Sub.
- Manipulating complex data structures like hashes, lists, sets, and sorted sets.
- Executing atomic increments or conditional key updates.
- Running Lua scripts for advanced Redis logic.
- Performing batch operations on multiple keys efficiently.
Practical examples:
- Adding members to a Redis set to track active user sessions.
- Incrementing counters atomically for analytics.
- Publishing messages to channels for event-driven architectures.
- Scanning keys matching a pattern for maintenance or monitoring.
- Setting expiration times on keys to implement TTL-based cache invalidation.
Properties
| Name | Meaning |
|---|---|
| Operation | The Redis operation to perform. Options include: Append, Blocking Pop Left/Right, Delete, Eval, Exists, Expire At, Get, Get Set, Hash Exists/Get/Keys/Length/Set/Values, Increment, Info, Keys, List Length/Range, Multi Get/Hash Get/Mix Get/Mix Set/Multi Set, Persist, Pop, Publish, Push, Scan, Set, Set Add/Remove/Is Member/Cardinality, Sorted Set Add/Remove/Cardinality/Range, String Length, TTL. |
| Value Is JSON | (For hash operations) Whether the value should be parsed as JSON or treated as plain key-value pairs. |
| Set | Name of the Redis set to operate on (used in set-related operations like sadd, srem, sismember, scard). |
| Members | Space-separated list of members to add or remove from a set (used in sadd, srem). |
Additional relevant properties (not exhaustive but related to the "Set Add" operation context):
| Name | Meaning |
|---|---|
| Key | Name of the key in Redis (used in many operations). |
| Members | Space-separated members for set operations. |
| Property Name | Name of the property where retrieved data will be stored in the output JSON (supports dot notation). |
| Key Type | Type of the key (automatic, hash, list, sets, string) to guide how data is handled. |
| Expire | Boolean indicating if a TTL should be set on the key. |
| TTL | Time-to-live in seconds for key expiration. |
| Set Mode | Controls when the key should be set (always, only if not exists, only if exists). |
Output
The node outputs an array of items, each containing a json object with the results of the Redis operation performed. The structure of the json output depends on the operation:
For Set Add (
sadd) operation:{ "set": "name_of_set", "added": <number_of_members_added>, "members": ["member1", "member2", ...] }This indicates which set was modified, how many members were successfully added, and the list of members attempted to add.
For other operations, the output varies accordingly, e.g., key values, counts, boolean flags, or arrays of keys/members.
If the node encounters errors and is configured to continue on failure, it outputs an error message inside the
jsonfield under theerrorkey.Binary data is not explicitly handled or output by this node; all outputs are JSON objects representing Redis data or operation results.
Dependencies
- Requires a Redis server accessible via credentials configured in n8n.
- Needs an API key credential or connection details for Redis authentication.
- Uses the official Redis client library for Node.js.
- No additional external services are required beyond Redis itself.
Troubleshooting
Common issues:
- Invalid Redis credentials or unreachable Redis server will cause connection failures.
- Incorrectly formatted input parameters (e.g., uneven key-value pairs in multi-set operations) will throw errors.
- JSON parsing errors when
valueIsJSONis true but the provided value is not valid JSON. - Using unsupported or misspelled operation names will result in no action or errors.
Error messages and resolutions:
"Invalid JSON in value: ...": Ensure that the value provided is valid JSON whenvalueIsJSONis enabled."Key-value pairs must be even number of arguments": When using multi-set operations, provide pairs of keys and values correctly.- Connection errors: Verify Redis server availability and correct credentials.
- Timeout or blocking pop operations may hang if the timeout is set incorrectly; verify timeout values.
To handle errors gracefully, enable the "Continue On Fail" option in the node settings.
Links and References
- Redis Official Documentation
- Redis Commands Reference
- Node Redis Client GitHub
- n8n Documentation (for general usage guidance)