Actions36
- Append
- Blocking Pop Left
- Blocking Pop Right
- Delete
- Eval
- Exists
- Expire At
- Get
- Get Set
- Hash Exists
- Hash Keys
- Hash Length
- Hash Values
- Increment
- Info
- Keys
- List Length
- List Range
- Multi Get
- 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
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, delete, and manipulate data stored in Redis with enhanced capabilities such as working with hashes, lists, sets, sorted sets, and executing Lua scripts.
For the TTL operation specifically, this node retrieves the time-to-live (TTL) value for a given key in Redis, which indicates how many seconds remain before the key expires. This is useful for monitoring cache expiration or managing temporary data lifecycles.
Common scenarios:
- Checking if cached data is about to expire.
- Monitoring session keys or tokens with expiration.
- Managing expiring keys in distributed applications.
Example:
You want to check how long a user session key will remain valid in Redis before it expires. Using this node's TTL operation, you input the session key name and receive the remaining TTL in seconds.
Properties
| Name | Meaning |
|---|---|
| Value Is JSON | Whether the value is JSON or key-value pairs (only shown when key type is "hash"). |
| Key | The name of the Redis key for which to get the TTL (required for TTL and Persist ops). |
Output
The output JSON object for the TTL operation has the following structure:
{
"key": "the_key_name",
"ttl": 123
}
key: The Redis key queried.ttl: The time to live in seconds. A value of -1 means the key exists but has no associated expiration. A value of -2 means the key does not exist.
No binary data output is produced by this operation.
Dependencies
- Requires a Redis server connection.
- Requires an API key credential or authentication token configured in n8n to connect to Redis.
- Uses the Redis client library internally to communicate with the Redis instance.
Troubleshooting
Common issues:
- Connection failures due to incorrect Redis credentials or network issues.
- Querying TTL for a non-existent key returns -2; ensure the key exists.
- Permissions issues if the Redis user lacks access to certain commands.
Error messages:
- Errors during connection or command execution will be thrown as node errors.
- If "Continue On Fail" is enabled, errors for individual items will be returned in the output JSON under an
errorproperty.
Resolution tips:
- Verify Redis credentials and connectivity.
- Confirm the key exists before querying TTL.
- Check Redis server logs for permission or command errors.