Skip to main content

Redis

Redis is used as a distributed, in-memory key-value database. Redis uses abstract data structures, such as strings, lists, maps, etc. It is best suited for developers who need quick responses.

Prerequisites

  1. Authentication Credentials: Before establishing a connection with your Redis instance, ensure you have the required authentication credentials, which typically include:

    • Redis server hostname or IP address.
    • Port number for Redis communication.
    • Authentication password.
  2. Connection Security:

    • Configure secure communication protocols (e.g., SSL/TLS) if required by your Redis setup.
  3. Firewall and Network Configuration:

    • Adjust your firewall settings to allow communication between your application and the Redis server.

Having these essential prerequisites in place will ensure a secure and seamless integration of Redis with your applications, facilitating efficient data management and utilization.

Configuring Connector in DronaHQ

Configure your database category using the provided details. Validate connection with Test connection and Save settings for secure database setup.

tip

DronaHQ can Auto fill crucial connection values like host, name, password, and more from the connector's connection string.

General

FieldDescription
HostEnter the Host Domain or IP
PortEnter the Port number
PasswordEnter the Password
Database NumberEnter the database number to connect.
Redis with Sample details.
Redis with Sample details.

Admin

Advanced OptionDescription
Connection OptionsThe key and value connection options in database configuration refer to specific settings (keys) and their corresponding values that dictate how the application connects to the database
Use Dynamic Database HostDynamically determine the host for the database connection.
Whitelist IP Enhance security by restricting database access to specific whitelisted IP addresses.

Adding Data Queries

  1. Query Name: Assign a unique name to your data retrieval query. This name will help you easily identify and access the query within your Connector Library.

  2. Select Action - Get Value by Key: Choose the Get Value by Key action from the available options in the Redis connector. This action allows you to retrieve the value associated with a specific key in the Redis key-value store.

  3. Configure Parameters:

ParameterDescription
KeySpecify the key for which you want to retrieve the value.
FieldSpecify the field name within a Redis hash to retrieve the value.
Index NameSpecify the name of the index for querying Redis Sorted Sets.
MemberSpecify the member within a Redis Sorted Set to retrieve the value.
  1. Execute the Query: After configuring the parameters, execute the query by clicking the Run button. The value associated with the specified key will be fetched from the Redis database.
Redis Get Value by Key action.
Redis Get Value by Key action.
tip

Use double curly brackets for dynamic variables. Test with sample values before saving. Link dynamic variables to controls/actions and more for runtime use.

Saved queries appear under your connector in Connector Library.

Supported Actions

ActionDescription
GETRetrieve the value of a specified key.
SETSet the value of a key.
DELDelete a key.
KEYSRetrieve all keys matching a specified pattern.
MGETRetrieve the values of multiple keys.
HGETRetrieve the value of a field in a hash.
HMGETRetrieve the values of multiple fields in a hash.
HGETALLRetrieve all fields and values from a hash.
HSETSet the value of a field in a hash.
HSETNXSet the value of a field in a hash, only if the field does not exist.
HLENGet the number of fields in a hash.
HDELDelete one or more fields from a hash.
HKEYSRetrieve all field names from a hash.
HVALSRetrieve all values from a hash.
LINDEXRetrieve an element from a list by its index.
LLENGet the length of a list.
LPUSHPrepend one or more values to a list.
LREMRemove elements from a list.
RPOPLPUSHRemove the last element in a list and prepend it to another list.
LRANGERetrieve elements from a list within a specified range.
SADDAdd one or more members to a set.
SCARDGet the number of members in a set.
SMEMBERSRetrieve all members of a set.
SISMEMBERCheck if a member exists in a set.
SRANDMEMBERGet one or more random members from a set.
SREMRemove one or more members from a set.
ZADDAdd one or more members to a sorted set.
ZCARDGet the number of members in a sorted set.
ZCOUNTCount the number of members in a sorted set within a specified score range.
ZRANGERetrieve members from a sorted set within a specified range.
ZRANGEBYSCORERetrieve members from a sorted set within a specified score range.
ZRANKDetermine the rank of a member in a sorted set.
ZREMRemove one or more members from a sorted set.
ZSCORERetrieve the score of a member in a sorted set.

Using Redis Connector for Data Retrieval

Get All Keys

To retrieve all keys from your Redis database using the Redis connector, follow these steps:

  1. Choose the Keys Action: Begin by selecting the action type as Keys within the Redis connector options. This will allow you to interact with the keys stored in your Redis database.

  2. Configure the Action for All Keys: In order to retrieve all keys, set the key pattern as * (an asterisk), which serves as a special character to match all keys in your Redis database.

Redis Keys Action to get all keys.
Redis Keys Action to get all keys.
  1. Data Display Configuration: Configure the query to display the retrieved keys in a control, such as a dropdown. To do this, navigate to Bind Data > Connectors and set up the query accordingly.

  2. Test and Implement: After providing the necessary parameters and configuring the query, perform a test run to ensure the query functions as intended. Once validated, finalize the configuration and implement the connector.

  3. Access Data for Dropdown Control: To fetch the retrieved keys for the dropdown control, use the result.rows parameter to access the data returned by the query.