Redis Enhanced icon

Redis Enhanced

Get, send and update data in Redis with enhanced operations

Overview

The node "Redis Enhanced" provides a comprehensive interface to interact with a Redis database, supporting a wide range of Redis operations. It allows users to get, set, update, and delete data in Redis with enhanced capabilities beyond basic commands. This node is beneficial for scenarios where you need to integrate Redis caching, messaging, or data storage into your workflows, such as:

  • Managing sets and sorted sets for user sessions or leaderboards.
  • Publishing messages to Redis channels for real-time notifications.
  • Performing atomic increments or conditional key updates.
  • Executing Lua scripts for complex Redis transactions.
  • Scanning keys or managing expiration times on keys.

For example, you could use this node to add members to a Redis set, check if a member exists, or retrieve the cardinality (number of members) of a set, which is useful for counting unique visitors or active users.

Properties

Name Meaning
Value Is JSON Whether the value is JSON or key-value pairs (only shown when key type is hash).
Set Name of the set to operate on (used in set-related operations like sadd, srem, sismember, scard).

These properties are relevant specifically for the "Set Cardinality" operation and related set operations.

Output

The output JSON structure depends on the specific operation performed. For the "Set Cardinality" (scard) operation, the output JSON includes:

  • set: The name of the Redis set queried.
  • cardinality: The number of members in the set (an integer).

Example output JSON for "Set Cardinality":

{
  "set": "mySet",
  "cardinality": 42
}

If other set operations are used (like adding or removing members), the output will include fields such as added, removed, members, or isMember accordingly.

The node does not output binary data; all outputs are JSON objects representing the results of Redis commands.

Dependencies

  • Requires a Redis server connection configured via an API key credential (generic Redis authentication).
  • The node uses a Redis client library internally to communicate with the Redis instance.
  • No additional external services are required beyond the Redis server.
  • The Redis credentials must be properly configured and tested within n8n for successful connection.

Troubleshooting

  • Connection Issues: If the node cannot connect to Redis, verify that the Redis server is reachable, credentials are correct, and network/firewall settings allow access.
  • Invalid Key or Set Names: Ensure that the set names and keys provided are valid strings without unsupported characters.
  • Incorrect Member Format: For operations requiring multiple members (e.g., sadd, srem), members should be space-separated strings. An odd number of arguments in key-value pairs (for multi-set) will cause errors.
  • Operation Not Supported: Using an operation not supported by the node or providing parameters incompatible with the operation will result in errors.
  • Error Handling: If the node is set to continue on failure, errors for individual items will be included in the output JSON under an error field. Otherwise, execution stops at the first error.
  • Timeouts and Expirations: When setting expirations, ensure TTL values are positive integers; otherwise, the expiration may not be set correctly.

Common error messages typically indicate issues with command parameters or connectivity and can be resolved by checking input correctness and Redis server status.

Links and References

Discussion