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, delete, and manipulate data stored in Redis with enhanced capabilities beyond basic commands.

For the String Length operation specifically, the node retrieves the length of the string value stored at a specified key in Redis. This is useful when you need to know the size of a string stored in Redis without retrieving the entire value.

Common scenarios:

  • Checking the length of cached string data before processing.
  • Validating that a string value meets certain length requirements.
  • Monitoring or debugging Redis keys by inspecting their string lengths.

Practical example:

  • You have a Redis key storing a JSON string representing user session data. Before parsing or processing it, you want to check its length to ensure it is not empty or too large.

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 name queried.
  • length: The length (number of characters) of the string stored at the given key.

Example output JSON:

{
  "key": "myStringKey",
  "length": 42
}

This output indicates the string stored at "myStringKey" has 42 characters.

The node does not output binary data for this operation.

Dependencies

  • Requires a connection to a Redis instance.
  • Needs an API key credential or authentication token configured in n8n to connect securely to Redis.
  • Uses the Redis client library internally to perform commands.
  • No additional external services are required.

Troubleshooting

  • Common issues:

    • The specified key does not exist in Redis: The length returned will be zero or the command may return null depending on Redis behavior.
    • Connection failures: Ensure Redis credentials and network access are correctly configured.
    • Incorrect key type: If the key stores a non-string type (e.g., list or hash), the string length command may fail or return unexpected results.
  • Error messages:

    • Connection errors: Check Redis server availability and credentials.
    • Command errors: For example, if the key type is incompatible, Redis may return an error which the node surfaces. Verify the key type matches expected string type.
  • To resolve errors, verify the Redis key exists, is of string type, and the node's Redis credentials are valid.

Links and References

Discussion