Overview
This node stores data in a Redis cache with a configurable expiration time. It supports storing simple strings, JSON objects, or Redis hashes (key-value field sets). This is useful for caching frequently accessed data to improve application performance, session storage, or sharing state between workflows.
Practical examples:
- Caching user profile data keyed by user ID to reduce database load.
- Storing API response data temporarily to avoid repeated calls.
- Saving session information as a hash with multiple fields like tokens and timestamps.
Properties
| Name | Meaning |
|---|---|
| Key | Unique key under which the data will be stored in Redis. Prefixes are recommended for organization. |
| Data Type | Type of data to store. Options: String (simple string), JSON (object serialized as JSON), Hash (Redis hash with multiple fields). |
| Value | The value to store when Data Type is String or JSON. For JSON, provide valid JSON format. |
| Hash Fields | When Data Type is Hash, specify one or more fields with their names and values to store in the hash. |
| Expiration (seconds) | Time in seconds after which the cached data expires. Use 0 for no expiration. Examples: 3600 = 1 hour, 86400 = 1 day, 604800 = 1 week. |
Output
The node outputs an array of JSON objects, each representing the result of storing one input item. Each output object contains:
key: The Redis key used.dataType: The type of data stored (string,json, orhash).success: Boolean indicating if the operation succeeded.expiresIn: Number of seconds until expiration or"never"if no expiration was set.timestamp: ISO timestamp of when the data was stored.
No binary data is output by this node.
Dependencies
- Requires a Redis server connection configured via credentials including host, port, optional username/password, database number, and TLS settings.
- Uses an internal Redis connection helper to manage the connection.
- The node expects a valid Redis environment accessible from n8n.
Troubleshooting
- Invalid JSON error: When using JSON data type, the provided value must be valid JSON. Invalid JSON strings will cause an error "O valor fornecido não é um JSON válido". Validate your JSON before input.
- Missing hash fields: For the hash data type, at least one field must be provided. Omitting fields results in an error "É necessário fornecer pelo menos um campo para o hash".
- Connection errors: If Redis credentials are incorrect or the server is unreachable, the node will throw errors related to connection failure.
- Expiration handling: Setting expiration to 0 disables expiry; ensure this is intentional to avoid stale cache entries.