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
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 hashes, lists, sets, sorted sets, executing Lua scripts, and more. The node is useful for workflows that require caching, session storage, real-time data processing, message publishing, or any scenario where Redis is used as a fast key-value store.
For the String Length operation specifically, the node retrieves the length of the string stored at a given Redis key. This can be helpful when you need to validate or monitor the size of string data in Redis without retrieving the entire value.
Practical Example
- You have user session tokens stored as strings in Redis and want to check their lengths to ensure they meet expected size constraints.
- You want to monitor the size of cached JSON strings to optimize memory usage.
Properties
| Name | Meaning |
|---|---|
| Key | The name of the Redis key whose string length you want to retrieve. |
Note: The provided properties JSON includes "Value Is JSON" and "Key", but for the String Length operation only the "Key" property is relevant and required.
Output
The output JSON object contains:
key: The Redis key queried.length: The length of the string stored at the specified key.
Example output:
{
"key": "myStringKey",
"length": 42
}
This output indicates the number of characters in the string value stored at the given key.
Dependencies
- Requires a Redis server accessible via credentials configured in n8n.
- Needs an API key credential or connection details for Redis authentication.
- Uses the Redis client library internally to perform commands.
Troubleshooting
- Common issues:
- Connection failures due to incorrect Redis credentials or network issues.
- Querying a key that does not exist or is not a string type may return length 0 or cause unexpected results.
- Error messages:
- Errors related to Redis connection will be thrown if credentials are invalid or the server is unreachable.
- If the key is missing, the length returned will typically be 0 (no error).
- Resolution:
- Verify Redis credentials and network connectivity.
- Ensure the key exists and holds a string value before using this operation.