Use Redis in Sim through a direct connection to a Redis instance. Workflows can read and write keys, work with hashes and lists, increment values, set expiration times, and run commands.
Use the block
Connect to any Redis instance to perform key-value, hash, list, and utility operations via a direct connection.
Actions
Redis Get
Get the value of a key from Redis.
Inputs and outputs
Redis Set
Set the value of a key in Redis with an optional expiration time in seconds.
Inputs and outputs
Input
| Parameter | Type | Required | Description |
|---|---|---|---|
url | string | Yes | Redis connection URL (e.g. redis://user:password@host:port) |
key | string | Yes | The key to set |
value | string | Yes | The value to store |
ex | number | No | Expiration time in seconds (optional) |
Output
| Parameter | Type | Description |
|---|---|---|
key | string | The key that was set |
result | string | The result of the SET operation (typically "OK") |
Redis Delete
Delete a key from Redis.
Inputs and outputs
Redis Keys
List all keys matching a pattern in Redis. Avoid using on large databases in production; use the Redis Command tool with SCAN for large key spaces.
Inputs and outputs
Input
| Parameter | Type | Required | Description |
|---|---|---|---|
url | string | Yes | Redis connection URL (e.g. redis://user:password@host:port) |
pattern | string | No | Pattern to match keys (default: * for all keys) |
Output
| Parameter | Type | Description |
|---|---|---|
pattern | string | The pattern used to match keys |
keys | array | List of keys matching the pattern |
count | number | Number of keys found |
Redis Command
Execute a raw Redis command as a JSON array (e.g. ["HSET", "key", "field", "value"]).
Inputs and outputs
Redis HSET
Set a field in a hash stored at a key in Redis.
Inputs and outputs
Input
| Parameter | Type | Required | Description |
|---|---|---|---|
url | string | Yes | Redis connection URL (e.g. redis://user:password@host:port) |
key | string | Yes | The hash key |
field | string | Yes | The field name within the hash |
value | string | Yes | The value to set for the field |
Output
| Parameter | Type | Description |
|---|---|---|
key | string | The hash key |
field | string | The field that was set |
result | number | Number of fields added (1 if new, 0 if updated) |
Redis HGET
Get the value of a field in a hash stored at a key in Redis.
Inputs and outputs
Input
| Parameter | Type | Required | Description |
|---|---|---|---|
url | string | Yes | Redis connection URL (e.g. redis://user:password@host:port) |
key | string | Yes | The hash key |
field | string | Yes | The field name to retrieve |
Output
| Parameter | Type | Description |
|---|---|---|
key | string | The hash key |
field | string | The field that was retrieved |
value | string | The field value, or null if the field or key does not exist |
Redis HGETALL
Get all fields and values of a hash stored at a key in Redis.
Inputs and outputs
Input
| Parameter | Type | Required | Description |
|---|---|---|---|
url | string | Yes | Redis connection URL (e.g. redis://user:password@host:port) |
key | string | Yes | The hash key |
Output
| Parameter | Type | Description |
|---|---|---|
key | string | The hash key |
fields | object | All field-value pairs in the hash as a key-value object. Empty object if the key does not exist. |
fieldCount | number | Number of fields in the hash |
Redis HDEL
Delete a field from a hash stored at a key in Redis.
Inputs and outputs
Input
| Parameter | Type | Required | Description |
|---|---|---|---|
url | string | Yes | Redis connection URL (e.g. redis://user:password@host:port) |
key | string | Yes | The hash key |
field | string | Yes | The field name to delete |
Output
| Parameter | Type | Description |
|---|---|---|
key | string | The hash key |
field | string | The field that was deleted |
deleted | number | Number of fields removed (1 if deleted, 0 if field did not exist) |
Redis INCR
Increment the integer value of a key by one in Redis.
Inputs and outputs
Redis INCRBY
Increment the integer value of a key by a given amount in Redis.
Inputs and outputs
Input
| Parameter | Type | Required | Description |
|---|---|---|---|
url | string | Yes | Redis connection URL (e.g. redis://user:password@host:port) |
key | string | Yes | The key to increment |
increment | number | Yes | Amount to increment by (negative to decrement) |
Output
| Parameter | Type | Description |
|---|---|---|
key | string | The key that was incremented |
value | number | The new value after increment |
Redis EXPIRE
Set an expiration time (in seconds) on a key in Redis.
Inputs and outputs
Input
| Parameter | Type | Required | Description |
|---|---|---|---|
url | string | Yes | Redis connection URL (e.g. redis://user:password@host:port) |
key | string | Yes | The key to set expiration on |
seconds | number | Yes | Timeout in seconds |
Output
| Parameter | Type | Description |
|---|---|---|
key | string | The key that expiration was set on |
result | number | 1 if the timeout was set, 0 if the key does not exist |
Redis TTL
Get the remaining time to live (in seconds) of a key in Redis.
Inputs and outputs
Input
| Parameter | Type | Required | Description |
|---|---|---|---|
url | string | Yes | Redis connection URL (e.g. redis://user:password@host:port) |
key | string | Yes | The key to check TTL for |
Output
| Parameter | Type | Description |
|---|---|---|
key | string | The key that was checked |
ttl | number | Remaining TTL in seconds. Positive integer if TTL set, -1 if no expiration, -2 if key does not exist. |
Redis PERSIST
Remove the expiration from a key in Redis, making it persist indefinitely.
Inputs and outputs
Redis LPUSH
Prepend a value to a list stored at a key in Redis.
Inputs and outputs
Redis RPUSH
Append a value to the end of a list stored at a key in Redis.
Inputs and outputs
Redis LPOP
Remove and return the first element of a list stored at a key in Redis.
Inputs and outputs
Redis RPOP
Remove and return the last element of a list stored at a key in Redis.
Inputs and outputs
Redis LLEN
Get the length of a list stored at a key in Redis.
Inputs and outputs
Redis LRANGE
Get a range of elements from a list stored at a key in Redis.
Inputs and outputs
Input
| Parameter | Type | Required | Description |
|---|---|---|---|
url | string | Yes | Redis connection URL (e.g. redis://user:password@host:port) |
key | string | Yes | The list key |
start | number | Yes | Start index (0-based) |
stop | number | Yes | Stop index (-1 for all elements) |
Output
| Parameter | Type | Description |
|---|---|---|
key | string | The list key |
values | array | List elements in the specified range |
count | number | Number of elements returned |
Redis EXISTS
Check if a key exists in Redis.
Inputs and outputs
Redis SETNX
Set the value of a key in Redis only if the key does not already exist.