Redis
This page provides information for connecting your application to your Redis database and using queries to manage its content.
Connect Redis
Appsmith does not support connection to Redis using TLS. To connect to Redis, you should whitelist the IP address of the Appsmith deployment 18.223.74.85
and 3.131.104.27
on your database instance or VPC before connecting to a database. If you're using Redis Cloud, you can see Configure CIDR allow list for more details.
Connection parameters
The following section is a reference guide that provides a complete description of all the parameters to connect to a Redis database.
Host Address
Port
6379
by default if you do not specify one.Database Number
Username
Password
Query Redis
The following section provides examples of creating basic CRUD queries for Redis.
See the Redis documentation for a full list of Redis commands and how to use them.
Fetch data
HGETALL {{ SearchInput.text }}
In the above example, SearchInput
is the name of an Input widget being used to collect a user's search term and send it in the query. The HGETALL
command returns all keys and values of a Redis hash with a matching name if it exists.
To store a single key not in a hash, use GET
:
GET {{ SearchInput.text }}
Insert data
HSET user:{{ EmailInput.text }} username {{ UsernameInput.text }} gender {{ GenderDropdown.selectedOptionVaue }}
In the above example, EmailInput
, UsernameInput
, and GenderDropdown
are the names of Input and Select widgets being used to collect user input and send it in the query to create a Redis hash.
To insert a single key/value pair not in a hash, use SET
:
SET username {{ UsernameInput.text }}