Redis
Redis in Illa is a database integration that allows you to connect and interact with a Redis database. Redis is a popular open-source relational database management system that is known for its speed, reliability, and ease of use.
With the Redis integration in Illa, you can query, insert, update, and delete data from a Redis database using SQL commands. You can also create custom SQL queries and run them within Illa. This makes it easy to build data-driven applications and dashboards that display real-time data from a Redis database.
Create Redis
There are two ways to create a resource in Illa after signing into your Illa account.
- Create in Resources
Sign into your Illa account, select **Resources**
on the top of the page, and click **Create New**
button.
Select Redis
from the database list.
Connect to the database with the required parameters described in Connection Settings
below.
Click **Test Connection**
to see if we can successfully connect to the database. If yes, click Save Resources
, else, double check the hostname, port, username, and password is correct.
After creating a resource, the ready Redis will display as shown.
- Create in Builder
Sign into your Illa account, create a project in Illa Builder in the **App**
page, and navigate to the Action List
at the bottom of the page. Click **new**
, then select Redis
from the database list. Then, connect to the database with required parameters described in Connection Settings
below.
Click **Test Connection**
to see if we can successfully connect to the database. If yes, click Save Resources
, else, double check the hostname, port, username, and password is correct.
Connection Settings
Here we need to provide information for connecting to Redis database.
Properties | Required | Description |
---|---|---|
Name | required | The name for resource when creating actions in the ILLA. |
Hostname | required | The URL or IP address for your database |
Port | required | The server host's port number that you should use to connect. If you don't specify a port, the default port is '6379'. |
Database Index | optional | a data structure that is used to optimize the performance of queries that retrieve data from a Redis database |
Database | required | The name of the database |
Username | required | the username you wish to use when logging in to the Redis server. |
Password | required | Use this password for authentication. |
SSL options | optional | decides how high a secure SSL TCP/IP connection is prioritized while negotiating with the server. |
Create Actions
We have created a Redis resource, we can add the action by selecting Redis from action list and choosing the Create action
button.
Now we have added the Redis server as an action to our building page.
Configure Redis
Properties | Description |
---|---|
query | commands to retrieve data from database |
Transformer | transforming data into the style you like using JavaScript |
Example usage:
- KEYS
This command retrieves a list of all keys in the Redis database. You can use wildcards to filter the keys by pattern.
KEYS *
KEYS user:*
- GET
This command retrieves the value associated with a given key.
GET user:12345
- HGETALL
This command retrieves all fields and their values from a Redis hash data structure.
HGETALL user:12345
- ZRANGE
This command retrieves a range of values from a Redis sorted set data structure, based on their scores.
ZRANGE high_scores 0 9 WITHSCORES
- LRANGE
This command retrieves a range of values from a Redis list data structure.
LRANGE my_list 0 4
- EXISTS
This command checks if a given key exists in the Redis database.
EXISTS user:12345
- TTL
This command retrieves the time-to-live (TTL) value associated with a key, which specifies how long the key will remain in the database before it expires.
TTL user:12345