1. Overview
Redis is an open-source, in-memory data structure store, used as a database, cache, and message broker. It supports various data structures such as strings, hashes, lists, sets, sorted sets with range queries, bitmaps, hyperloglogs, geospatial indexes, and streams.
With the GoInsight Redis node, you can seamlessly integrate Redis's powerful data management capabilities into your workflows. This allows you to perform a wide range of operations, including:
- Key Management: Get, set, and delete keys of various data types (string, hash, list, set, zset). You can also find keys using patterns and perform atomic operations like incrementing.
- List Operations: Treat Redis lists as queues by pushing elements to the head or tail, and popping them off.
- Pub/Sub Messaging: Publish messages to specific channels to communicate with other parts of your system.
- Server Monitoring: Retrieve detailed information and statistics about your Redis server instance.
2. Prerequisites
Before using this node, you need to have access to a Redis server instance. You will require the connection details, including the server's hostname (or IP address), port, and password (if applicable), to establish a connection.
3. Credentials
For a detailed guide on how to obtain and configure credentials, please refer to our official documentation: Credentials Configuration Guide.
4. Supported Operations
The Redis node allows you to interact with various resources like Keys, Lists, and Pub/Sub Channels. The following summary table outlines the supported operations.
Summary
Resource | Operation | Description |
---|---|---|
Channel | Publish | Publishes a message to a specified Redis channel. |
Key | Delete | Deletes one or more specified keys. |
Key | Get | Gets the value of a specified key, supporting multiple data types. |
Key | Increment | Atomically increments the number stored at a key. |
Key | Keys | Returns all keys matching a specified pattern. |
Key | Set | Sets a value for a specified key, with support for multiple data types and expiration. |
List | Pop | Removes and returns an element from the head or tail of a list. |
List | Push | Pushes one or more elements to the head or tail of a list. |
Server | Info | Retrieves detailed information and statistics about the Redis server. |
Operation Details
Publish
Publishes a message to a specified Redis channel and returns the number of subscribers that received the message, with comprehensive error handling and parameter validation.
Input Parameters
- Channel: The channel name to publish to.
Options
- MessageData: The message data to publish.
Output
- Success (bool): Whether the operation was successful.
- Channel (string): The channel that the message was published to.
- MessageData (string): The message data that was published.
- SubscribersCount (number): The number of subscribers that received the message.
- Database (number): The database number used for the connection.
- StatusCode (number): Operation status code: 200 (success), 500 (Redis error), -1 (parameter error).
- ErrorMessage (string): Error description if operation failed, empty on success.
Delete
Deletes specified key(s) from Redis. Supports deleting single key or multiple keys separated by commas.
Options
- Key: The key name(s) to delete (required). Supports single key or multiple keys separated by commas.
Output
- Success (bool): Whether the operation was successful.
- Key (string): The input key(s) that were attempted to be deleted.
- DeletedCount (number): The number of keys that were actually deleted.
- TotalKeys (number): The total number of keys that were attempted to be deleted.
- DeletedKeys (string-array): List of keys that were successfully deleted.
- NotFoundKeys (string-array): List of keys that were not found.
- Database (number): Database number.
- StatusCode (number): Operation status code: 200 (success), 500 (Redis error), -1 (parameter error).
- ErrorMessage (string): Error description if operation failed, empty on success.
Get
Gets the value of a specified key from Redis with support for multiple data types (string, hash, list, sets, zset).
Options
- Key: The key name to get (required).
- KeyType: Key type - one of: automatic, hash, list, sets, zset, string.
Output
- Success (bool): Whether the operation was successful.
- Key (string): The key that was retrieved.
- Value (string): The retrieved value, serialized as JSON string.
- KeyType (string): The actual key type retrieved.
- KeyExists (bool): Whether the key exists.
- Database (number): Database number.
- StatusCode (number): Operation status code: 200 (success), 500 (Redis error), -1 (parameter error).
- ErrorMessage (string): Error description if operation failed, empty on success.
Increment
Atomically increments the number stored at key by one or by the specified amount. If the key does not exist, it is set to the increment value.
Options
- Key: The key name to increment (required).
- IncrementBy: The value to increment by (default: 1).
- Expire: Whether to set expiration time.
- TTL: Time to live in seconds (must be positive when expire is true).
Output
- Success (bool): Whether the operation was successful.
- Key (string): The key that was incremented.
- CurrentValue (number): The current value after increment.
- IncrementBy (number): The value that was added to the key.
- ExpirationSet (bool): Whether expiration time was set.
- TTL (number): Time to live in seconds, -1 if no expiration was set.
- Database (number): Database number.
- StatusCode (number): Operation status code: 200 (success), 500 (Redis error), -1 (parameter error).
- ErrorMessage (string): Error description if operation failed, empty on success.
Keys
Returns all keys matching a specified pattern from Redis, with optional retrieval of their values and support for all Redis data types.
Options
- KeyPattern: Key pattern with wildcard support (* and ?).
- GetValues: Whether to retrieve values for matching keys.
Output
- Success (bool): Whether the operation was successful.
- KeysCount (number): Number of keys that matched the pattern.
- Keys (string-array): List of matching key names.
- KeysWithValues (object): Dictionary of keys and their values (only when GetValues=true).
- Pattern (string): The pattern used for matching.
- GetValues (bool): Whether values were retrieved.
- Database (number): The database number used for the connection.
- StatusCode (number): Operation status code: 200 (success), 500 (Redis error), -1 (parameter error).
- ErrorMessage (string): Error description if operation failed, empty on success.
Set
Sets a value for a specified key in Redis with support for multiple data types (string, hash, list, sets, zset) and optional expiration time.
Options
- Key: The key name to set (required).
- Value: The value to set.
- KeyType: Key type - one of: automatic, hash, list, sets, zset, string.
- ValueIsJSON: Whether the value is JSON format (for hash, list, sets, zset types).
- Expire: Whether to set expiration time.
- TTL: Time to live in seconds (must be positive when expire is true).
Output
- Success (bool): Whether the operation was successful.
- Key (string): The key that was set.
- Value (string): The value that was set.
- KeyType (string): The actual key type used for storage.
- ExpirationSet (bool): Whether expiration time was set.
- TTL (number): Time to live in seconds, -1 if no expiration was set.
- Database (number): Database number.
- StatusCode (number): Operation status code: 200 (success), 500 (Redis error), -1 (parameter error).
- ErrorMessage (string): Error description if operation failed, empty on success.
Pop
Removes and returns an element from a Redis list, supporting popping from either the head or tail with automatic JSON parsing and comprehensive error handling.
Input Parameters
- ListName: The name of the list to pop from.
Options
- FromTail: Whether to pop from the tail of the list, false for head (LPOP), true for tail (RPOP).
Output
- Success (bool): Whether the operation was successful.
- ListName (string): The name of the list that was operated on.
- PoppedValue (string): The popped value, automatically parsed as JSON if possible, otherwise returned as string.
- FromTail (bool): Whether the element was popped from the tail of the list.
- ListExists (bool): Whether the list exists in Redis.
- ListEmpty (bool): Whether the list was empty before the pop operation.
- Database (number): The database number used for the connection.
- StatusCode (number): Operation status code: 200 (success), 500 (Redis error), -1 (parameter error).
- ErrorMessage (string): Error description if operation failed, empty on success.
Push
Pushes data to a Redis list, supporting single or multiple elements to be added at either the head or tail with flexible data formats and comprehensive error handling.
Input Parameters
- ListName: The name of the Redis list to push data to.
Options
- Data: The data to push. It can be a single value, a JSON array (e.g. ["a", "b", "c"]), or a multi-line string (each line will be pushed as a separate element). Default is "".
- Tail: Whether to push to the tail of the list (true for tail/RPUSH, false for head/LPUSH).
Output
- Success (bool): Whether the operation was successful.
- ListName (string): The name of the list that data was pushed to.
- Data (string): The data that was pushed.
- Position (string): The position where data was pushed (head or tail).
- ItemsPushed (number): The number of items successfully pushed to the list.
- ListLength (number): The total length of the list after push operation.
- Database (number): The database number used for the connection.
- StatusCode (number): Operation status code: 200 (success), 500 (Redis error), -1 (parameter error).
- ErrorMessage (string): Error description if operation failed, empty on success.
Info
Retrieves detailed information and statistics about the Redis server, including server configuration, memory usage, client connections, and database statistics.
Output
- Success (bool): Whether the operation was successful.
- Info (object): Redis server information containing various statistics and configuration data.
- Database (number): The database number used for the connection.
- StatusCode (number): Operation status code: 200 (success), 500 (Redis error), -1 (parameter error).
- ErrorMessage (string): Error description if operation failed, empty on success.
5. Example Usage
This section will guide you through creating a simple workflow to store a user's session information in Redis using the Set operation.
The workflow will look like this: Start -> Redis: Set -> Answer.
1. Add the Tool Node
- On the workflow canvas, click the + icon to add a new node.
- In the panel that appears, select the "Tools" tab.
- Find and select Redis from the list of tools.
- In the list of supported operations for Redis, click Set. This will add a "Set" node to your canvas.
2. Configure the Node
- Click on the newly added Set node to open its configuration panel on the right.
- Configure Credentials: At the top of the panel, find the credentials field. Click the dropdown menu and select the Redis credentials you have already configured.
- Fill in Parameters:
- Key: Enter a unique key for the user's session. For example, session:user123.
- Value: Input the data you want to store. This can be a simple string or a JSON object. For example, {"userId": "123", "loginTime": "2025-09-22T10:00:00Z", "role": "editor"}.
- KeyType: Leave this as automatic or select string.
- ValueIsJSON: If your value is a JSON object as in the example, set this to true.
- Expire: Toggle this to true to make the session key automatically expire.
- TTL: Set the time-to-live in seconds. For example, 3600 for a 1-hour session.
3. Run and Validate
- Once all required parameters are filled in correctly, any error indicators on the workflow canvas will disappear.
- Click the "Test Run" button in the top-right corner of the canvas to execute the workflow.
- After a successful execution, you can click the log icon in the top-right corner to view the detailed input and output of the node, confirming that the operation was successful.
After completing these steps, your workflow is fully configured. When you run it, a new key representing the user's session will be created in your Redis database and will automatically expire after one hour.
6. FAQs
Q: Why is my connection to Redis failing?
A: Please check the following:
- Host and Port: Ensure the Redis server's hostname/IP address and port are correct.
- Password: If your Redis server requires authentication, make sure you have provided the correct password in your credentials configuration.
- Network Access: Verify that your GoInsight instance has network access to the Redis server. There may be firewall rules or network security groups blocking the connection.
Q: Why did my key disappear?
A: The key may have had an expiration time (TTL) set. When you use the Set or Increment operations, you have the option to set a TTL. Once this time elapses, Redis automatically deletes the key. If you need the key to persist indefinitely, make sure the Expire option is set to false.
Q: What is the difference between Value and ValueIsJSON in the Set operation?
A: The Value field is where you place the content you want to store. The ValueIsJSON toggle tells the node how to handle that content for complex types like Hashes or Lists. If ValueIsJSON is true, the node will parse the string in the Value field as a JSON object before sending it to Redis. This is necessary when you want to store a structured object in a Redis Hash, for example. For simple string values, you can leave it as false.
7. Official Documentation
For more in-depth information about Redis commands and features, please refer to the Redis Official Documentation.
Leave a Reply.