Overview
This node interacts with a Redis database, specifically to set the value of a key in Redis. It supports different data types for the key (automatic detection, hash, list, sets, string) and allows setting expiration time (TTL) on the key. It is useful for scenarios where you need to store or update data in Redis, such as caching, session storage, or real-time data updates.
Use Case Examples
- Setting a string value for a key in Redis for caching user session data.
- Storing a JSON object as a hash in Redis for structured data storage.
- Setting a list or set type key with multiple values in Redis for real-time messaging or leaderboard data.
Properties
| Name | Meaning |
|---|---|
| Connection Mode | How to manage Redis connections, either reusing connections for better performance or creating a new connection each time for safety. |
| Key | Name of the key to set in Redis, required for the set operation. |
| Value | The value to write in Redis for the specified key. |
| Key Type | The type of the key to set, which affects how the value is stored and interpreted in Redis. |
| Value Is JSON | Whether the value is JSON or key-value pairs, applicable when the key type is 'hash'. |
| Expire | Whether to set a timeout on the key. |
| TTL | Number of seconds before key expiration, applicable if Expire is true. |
Output
JSON
json- The output JSON object contains the result of the set operation, typically the original input data or confirmation of the set action.
Dependencies
- Redis server connection
- An API key credential for Redis authentication
Troubleshooting
- Connection issues: Ensure Redis server credentials are correct and the server is reachable.
- Timeouts or slow performance: Consider using pooled connection mode for better performance.
- Data type mismatches: Ensure the key type matches the data format being set, especially when using hash or list types.
- JSON parsing errors: When setting hash type with JSON value, ensure the JSON is well-formed.
Links
- Redis SET Command - Official Redis documentation for the SET command, explaining usage and options.
- Redis Data Types - Overview of Redis data types such as strings, hashes, lists, and sets.