2023-03-16 07:28:33 +00:00
---
id: redis
title: Redis
---
# Redis
ToolJet can run Redis commands on your Redis instances.
## Connection
ToolJet requires the following to connect to your Redis instances.
< img class = "screenshot-full" src = "/img/redis/connect.png" alt = "ToolJet - Redis connection" height = "250" / >
- **Host**
- **Port** - The default port for Redis server is 6379
- **Username**
- **Password**
Click on "Test" button to test the connection and click "Save" to save the data source.
## Redis Queries
2023-08-09 06:47:43 +00:00
Here are some examples of Redis commands and their usage. You can refer to the [Redis Official Documentation ](https://redis.io/commands ) for a complete list of supported commands.
2023-03-16 07:28:33 +00:00
2023-08-09 06:47:43 +00:00
### PING Command
2023-03-16 07:28:33 +00:00
2023-08-09 06:47:43 +00:00
The `PING` command is used to test the connection to Redis. If the connection is successful, the Redis server will respond with `PONG` .
2023-03-16 07:28:33 +00:00
```shell
PING
```
2023-08-09 06:47:43 +00:00
### SET Command
The `SET` command is used in Redis to assign a value to a specific key.
2023-03-16 07:28:33 +00:00
```shell
SET key value
```
2023-08-09 06:47:43 +00:00
**Example 1/2:**
When the input value contains spaces, you should encode the value before providing it as an input:
```shell
SET products {{encodeURI('John Doe')}}
```
< div style = {{textAlign: ' center ' } } >
< img className = "screenshot-full" src = "/img/datasource-reference/redis/encode.png" alt = "Redis" / >
< / div >
### GET Command
The `GET` command is used in Redis to retrieve the value associated with a specific key.
2023-03-16 07:28:33 +00:00
```shell
GET key
```
2023-08-09 06:47:43 +00:00
**Example 2/2:**
To retrieve a value that was previously encoded while setting, you can use transformations.
- Enter the GET command in the editor:
```shell
GET products
```
- Enable Transformations (JS) and use `decodeURI` :
```js
return JSON.parse(decodeURI(data));
```
< div style = {{textAlign: ' center ' } } >
< img className = "screenshot-full" src = "/img/datasource-reference/redis/decode.png" alt = "Redis" / >
< / div >