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 including setting key expirations, manipulating strings, lists, sets, sorted sets, hashes, and executing Lua scripts. The "Expire" operation specifically allows users to set a time-to-live (TTL) on a given key, after which the key will automatically be removed from the Redis store.
Common scenarios for using this node include:
- Automatically expiring cache entries after a certain period.
- Managing session data that should only persist temporarily.
- Implementing rate limiting by expiring keys after a timeout.
- Cleaning up temporary or transient data in Redis.
For example, you might use the "Expire" operation to set a key "user:1234:session" to expire after 3600 seconds (1 hour), ensuring session data is automatically cleared.
Properties
| Name | Meaning |
|---|---|
| Key | The name of the Redis key to set an expiration on. |
| Seconds | Number of seconds until the key expires (minimum value is 1). |
| Value Is JSON | Whether the value is JSON or key-value pairs (only relevant if key type is "hash"). |
Output
The output JSON object for the "Expire" operation contains:
key: The name of the key on which expiration was set.seconds: The number of seconds until the key expires.set: A boolean indicating whether the expiration was successfully set (true) or not (false).
Example output JSON:
{
"key": "myKey",
"seconds": 60,
"set": true
}
This confirms that the expiration was applied successfully.
Dependencies
- Requires a Redis server connection configured via credentials providing necessary authentication.
- The node uses a Redis client library internally to communicate with the Redis instance.
- No additional external services are required beyond the Redis server itself.
Troubleshooting
Common issues:
- Invalid or missing Redis credentials can cause connection failures.
- Setting expiration on a non-existent key will return
set: false. - Providing a
secondsvalue less than 1 will likely cause validation errors.
Error messages:
- Connection errors typically indicate misconfigured credentials or unreachable Redis server.
- If the key does not exist, the operation returns
set: falsewithout throwing an error. - Errors during execution will throw exceptions unless "Continue On Fail" is enabled, in which case errors are returned in the output JSON under an
errorproperty.
To resolve these:
- Verify Redis credentials and network connectivity.
- Ensure the key exists before setting expiration.
- Use valid positive integers for the expiration seconds.
Links and References
- Redis EXPIRE command documentation
- Redis official website
- n8n Documentation (for general node usage and credential setup)