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, "Redis Enhanced," provides a comprehensive interface to interact with a Redis database. It supports a wide range of Redis operations such as retrieving keys by pattern, getting and setting values, incrementing counters, managing lists, sets, sorted sets, hashes, publishing messages, running Lua scripts, and more.
The Keys operation specifically returns all keys matching a given pattern, optionally fetching their associated values. This is useful for scenarios where you want to discover or audit keys in your Redis instance that match certain criteria, for example:
- Retrieving all session keys starting with
session:*. - Fetching all cache keys related to a specific service.
- Debugging or monitoring keys by pattern and optionally inspecting their stored values.
Properties
| Name | Meaning |
|---|---|
| Key Pattern | The pattern used to match keys in Redis (e.g., user:* to match all user-related keys). |
| Get Values | Boolean flag indicating whether to fetch the values of the matched keys (true or false). |
| Value Is JSON | (Shown only if key type is hash) Indicates if the value should be interpreted as JSON or key-value pairs. |
Output
The output is an array of JSON objects, each representing the result of processing one input item.
For the Keys operation:
- If Get Values is
false, the output JSON contains a single propertykeyswhich is an array of strings listing all matching keys. - If Get Values is
true, the output JSON contains properties named after each matched key, with their corresponding values fetched from Redis. The values are retrieved according to their Redis data type and deserialized appropriately.
Example output when getValues is false:
{
"keys": ["key1", "key2", "key3"]
}
Example output when getValues is true (simplified):
{
"key1": "value1",
"key2": { "field1": "val1", "field2": "val2" },
"key3": [ "listItem1", "listItem2" ]
}
Dependencies
- Requires a Redis server accessible via credentials configured in n8n.
- Needs an API key or connection credentials for Redis (configured in n8n credential settings).
- Uses the official Redis client library for Node.js.
- No additional external services are required.
Troubleshooting
- Connection errors: Ensure Redis credentials are correct and the Redis server is reachable.
- Pattern matching returns no keys: Verify the key pattern syntax; Redis patterns support glob-style wildcards like
*. - Fetching values fails: Could be due to unsupported or unexpected data types in Redis keys. Check if the key exists and its type matches expectations.
- Timeouts or slow responses: Large numbers of keys or large values can cause delays. Consider using the
scanoperation for incremental iteration instead. - Error: "Key-value pairs must be even number of arguments" (not specific to Keys but relevant for other operations): Ensure key-value inputs are correctly paired.
Links and References
- Redis Commands Documentation
- Redis Key Patterns
- Node Redis Client GitHub
- n8n Documentation (for general usage of this node)