How to use IBM App Connect with Redis
Redis (REmote DIctionary Server) is an open source data store, which holds data in memory and functions as a database, cache, and message broker.
As a NoSQL database, Redis stores key-value pairs in data structures (such as string, hash, and list data types) rather than within tables and other database objects, which are used by SQL-based relational databases. Redis also provides a set of commands that can be used to execute operations on the Redis server (for example, SET and GET) in much the same way as SQL-based statements such as INSERT or SELECT.
App Connect Enterprise as a Service connector
-
Local connector in containers (Long Term Support Cycle-3 release) 13.0.7.0-r1 or later
Local connector in containers (Continuous Delivery release)
-
Local connector in containers (Long Term Support Cycle-2 release)
The following information describes how to use IBM® App Connect to connect Redis to your other applications.
Supported product and API versions
To find out which product and API versions this connector supports, see Detailed System Requirements on the IBM Support page.
Connecting to Redis
To connect App Connect to an Redis account that you want App Connect to use, you need the following connection details, which should be available from your instance. For example, if using IBM Cloud® Databases for Redis, you can obtain the connection values from the Connections panel and Service Credentials panel of your service instance in IBM Cloud.
- Redis hostname or IP address: Specify the hostname or IP address of the Redis server.
- Redis port number: Specify the port number of the Redis server.
- Username: Specify the username
required for authentication.Note: Currently,.
adminis the default value, but you can choose to fill the Username field according to your requirement. - Password: Specify the password required for authentication.
- Database number: Optionally specify the database index of the database to
connect to, typically from a range of
0to15. (The index is generally shown at the end of a Redis URL.) The default is0. - Allow certificate validation: Set to
trueorfalseto indicate whether the database is secured using TLS authentication and encryption. If set totrue, you'll need to provide an SSL or a TSL certificate to validate against the root certificate from the certificate authority (CA). The default istrue. - Certificate: If Allow certificate validation is
set to
true, a certificate is mandatory. Specify the contents of the CA signed certificate for the cluster that hosts the database, in Base64 format. You can copy and paste the Base64-encoded contents directly from your instance.
To connect to a Redis endpoint from the App Connect Designer page for the first time, expand Redis, then click Connect.
Before you use the account that is created in App Connect in a flow, rename the account to something meaningful that helps you to identify it. To rename the account on the Applications and APIs page, select the account, open its options menu (⋮), then click Rename Account.
What should I consider first?
Before you use App Connect Designer with Redis, take note of the following considerations:
- (General consideration) You can see lists of the trigger events and
actions that are available on the Applications and APIs
page of the App Connect Designer.
For some applications, the events and actions depend on the environment and whether the connector supports configurable events and dynamic discovery of actions. If the application supports configurable events, you see a Show more configurable events link under the events list. If the application supports dynamic discovery of actions, you see a Show more link under the actions list.
- (General consideration) If you are using multiple accounts for an application, the set of fields that is displayed when you select an action for that application can vary for different accounts. In the flow editor, some applications always provide a curated set of static fields for an action. Other applications use dynamic discovery to retrieve the set of fields that are configured on the instance that you are connected to. For example, if you have two accounts for two instances of an application, the first account might use settings that are ready for immediate use. However, the second account might be configured with extra custom fields.
- App Connect supports the following Redis deployments:
- IBM Redis v6.x to v7.x: IBM Cloud Databases for Redis and IBM Compose for Redis
Important: Redis versions below v6 are not supported. - App Connect supports the following Redis data structures, which are exposed as objects:
- Hashes
- Keys
- Lists
- Sets
- Sorted Sets
- Strings
- App Connect also supports a subset of Redis commands, which are exposed as actions. You can see which Redis
commands are supported by expanding the list of objects on the Applications tab. For example,
the following commands are supported for hashes:
- HSET key field value: Set the string value of a hash field
- HEXISTS key field: Determine if a hash field exists
- HLEN key: Get the number of fields in a hash
- HGET key field: Get the value of a hash field
Figure 1. Redis actions available for Hashes 
Events and actions
Redis events
These events are for changes in this application that trigger a flow to start completing the actions in the flow.
Redis actions
Your flow completes these actions on this application.
| Object | Action | Description |
|---|---|---|
| Hashes | Check hash field presence | Determines whether a field exists in a hash |
| Retrieve hash field count | Returns the number of fields in a hash | |
| Retrieve hash field value | Returns the value of a field in a hash | |
| Update or create hash | Updates a hash if it exists, or creates a hash if it doesn't exist | |
| Keys | Check key presence | Determines whether one or more keys exist |
| Delete key | Deletes keys | |
| Remove expiry timeout from key | Removes the expiration time of a key to turn it into a persistent key | |
| Rename key | Renames the key and overwrites the destination | |
| Retrieve data type of key | Determines the type of value stored at a key | |
| Retrieve time to live of key | Returns the expiration time in seconds of a key | |
| Set expire-at time of key | Sets the expiration time of a key using an absolute Unix timestamp (seconds since January 1, 1970). A timestamp in the past will delete the key immediately. | |
| Set expiry timeout of key (seconds/milliseconds) | Sets a timeout on key (seconds/milliseconds). After the timeout has expired, the key will automatically be deleted. | |
| Lists | Retrieve list length | Returns the length of a list |
| Trim list | Trims an existing list so that it will contain only the specified range of elements | |
| Update list | Update s a list | |
| Update or create list | Updates a list if it exists, or creates a list if it doesn't exist | |
| Sets | Check set member presence | Determines whether a member belongs to a group |
| Retrieve set member count | Returns the number of members in a set | |
| Update or create set | Updates a set if it exists, or creates a set if it doesn't exist | |
| Sorted sets | Retrieve sorted set member count | Returns the number of members in a sorted set |
| Retrieve sorted set member count by score range | Returns the count of members in a sorted set that have scores within a range | |
| Retrieve sorted set member rank | Returns the index of a member in a sorted set ordered by ascending scores | |
| Retrieve sorted set member score | Returns the score of a member in a sorted set | |
| Update or create sorted set | Updates a sorted set if it exists, or creates a sorted set if it doesn't exist | |
| Strings | Append value to string | Appends a string to the value of key. Creates the key if it doesn't exist. |
| Retrieve value of string | Returns the string value of a key | |
| Update or create string | Updates a string if it exists, or creates a string if it doesn't exist |
Examples
Use templates to quickly create flows for Redis
Learn how to use App Connect templates to quickly create flows that complete actions on Redis. For example, go to the Discover page and search for Redis.
Model Context Protocol (MCP) support
The Redis connector supports MCP, and all Redis actions for the listed objects can be added to an MCP server as tools. For more information on how to configure an MCP server, see Creating and managing MCP servers.