Actions37
- Append
- Blocking Pop Left
- Blocking Pop Right
- Delete
- Eval
- Exists
- Expire
- Expire At
- Get
- Get Set
- Hash Exists
- Hash Keys
- Hash Length
- Hash Values
- Increment
- Info
- Keys
- List Length
- Multi Get
- Multi Set
- Persist
- Pop
- Publish
- Push
- Scan
- Set
- Set Add
- Set Cardinality
- Set Is Member
- Set Members
- Set Remove
- Sorted Set Add
- Sorted Set Cardinality
- Sorted Set Range
- Sorted Set Remove
- String Length
- TTL
Overview
This node, named "Redis Enhanced," provides a comprehensive interface to interact with a Redis database. It supports a wide range of Redis operations such as getting and setting keys, manipulating lists, sets, hashes, sorted sets, executing Lua scripts, and managing key expiration. The "Get" operation specifically retrieves the value of a specified key from Redis, supporting different data types (string, hash, list, set) and flexible output property naming.
Common scenarios where this node is beneficial include:
- Retrieving cached data stored in Redis for use in workflows.
- Accessing complex data structures like hashes or lists stored in Redis.
- Integrating Redis as a fast-access data store within automation pipelines.
- Dynamically reading values from Redis to influence subsequent workflow steps.
Practical example:
- A workflow that fetches user session data stored as a Redis hash by specifying the key and retrieving the JSON-parsed content into a workflow property for further processing.
Properties
| Name | Meaning |
|---|---|
| Name | The name of the property in the workflow's JSON output where the retrieved Redis data will be written. Supports dot-notation to create nested objects (e.g., "data.person[0].name"). |
| Key | The Redis key whose value you want to retrieve. |
| Key Type | The type of the Redis key to get. Options: - Automatic: Detects the key type before fetching (slower). - Hash: The key holds a hash data structure. - List: The key holds a list. - Sets: The key holds a set. - String: The key holds a string. |
| Options | Additional options for the get operation: - Dot Notation (boolean): Whether to interpret the property name using dot-notation (default true). If false, the property name is used literally without nesting. |
| Value Is JSON | (Only shown if Key Type is "Hash") Whether the hash values are JSON strings that should be parsed into objects, or simple key-value pairs. Defaults to true. |
Output
The node outputs an array of items, each containing a json object. For the "Get" operation:
- The retrieved Redis value is assigned to the property specified by the "Name" input property.
- If dot-notation is enabled, nested properties are created accordingly.
- The value can be any valid JSON type depending on the Redis data type and parsing (e.g., string, object, array).
- If the key does not exist or retrieval fails, the property will be set to
null.
No binary data output is produced by this operation.
Example output snippet for a key "user:1" with propertyName "data.user":
{
"json": {
"data": {
"user": {
"id": 1,
"name": "John Doe"
}
}
}
}
Dependencies
- Requires a Redis server accessible via credentials configured in n8n.
- Needs an API key or authentication token credential for connecting to Redis.
- Uses the Redis client library internally to perform commands.
- No additional external services are required beyond Redis itself.
Troubleshooting
- Connection errors: Ensure Redis credentials are correct and the Redis server is reachable.
- Key not found: If the specified key does not exist, the output property will be
null. - Incorrect key type: Selecting the wrong "Key Type" may cause unexpected results or errors. Use "Automatic" if unsure.
- JSON parsing errors: If "Value Is JSON" is true but the stored data is not valid JSON, parsing will fail. Set this option to false if values are plain strings.
- Dot notation issues: If the property name contains dots but you want to treat it as a literal key, disable dot notation in options.
Common error messages:
- Errors related to Redis command failures will be thrown with their message. Enabling "Continue On Fail" allows the workflow to proceed despite errors.
- "Key-value pairs must be even number of arguments" error occurs if key-value inputs are malformed (not applicable to Get operation but relevant for other operations).