Redis é um armazenamento de estruturas de dados em memória open-source, usado como banco de dados chave-valor distribuído, cache e message broker. O Redis oferece suporte a uma variedade de estruturas de dados, incluindo strings, hashes, listas, sets e mais, tornando-o altamente flexível para diferentes cenários de aplicação.
Com o Redis, você pode:
- Armazenar e recuperar dados chave-valor instantaneamente: Use o Redis como banco de dados rápido, cache ou armazenamento de sessão para alto desempenho.
- Trabalhar com múltiplas estruturas de dados: Gerencie não apenas strings, mas também listas, hashes, sets, sorted sets, streams e bitmaps.
- Executar operações atômicas: Manipule dados com segurança usando comandos atômicos e transações.
- Suportar mensagens pub/sub: Use os recursos de publisher/subscriber do Redis para tratamento de eventos e mensagens em tempo real.
- Definir políticas de expiração automática: Atribua TTLs às chaves para cache e dados sensíveis ao tempo.
- Escalar horizontalmente: Use o Redis Cluster para sharding, alta disponibilidade e cargas de trabalho escaláveis.
No Zoen, a integração com o Redis permite que seus agentes se conectem a qualquer instância compatível com Redis para realizar operações de chave-valor, hash, lista e utilitários. Você pode criar workflows que envolvem armazenar, recuperar ou manipular dados no Redis, ou gerenciar o cache, sessões ou mensagens em tempo real do seu app, diretamente no seu workspace Zoen.
Connect to any Redis instance to perform key-value, hash, list, and utility operations via a direct connection.
Get the value of a key from Redis.
| Parameter | Type | Required | Description |
|---|
url | string | Yes | Redis connection URL (e.g. redis://user:password@host:port) |
key | string | Yes | The key to retrieve |
| Parameter | Type | Description |
|---|
key | string | The key that was retrieved |
value | string | The value of the key, or null if the key does not exist |
Set the value of a key in Redis with an optional expiration time in seconds.
| 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) |
| Parameter | Type | Description |
|---|
key | string | The key that was set |
result | string | The result of the SET operation (typically "OK") |
Delete a key from Redis.
| Parameter | Type | Required | Description |
|---|
url | string | Yes | Redis connection URL (e.g. redis://user:password@host:port) |
key | string | Yes | The key to delete |
| Parameter | Type | Description |
|---|
key | string | The key that was deleted |
deletedCount | number | Number of keys deleted (0 if key did not exist, 1 if deleted) |
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.
| 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) |
| 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 |
Execute a raw Redis command as a JSON array (e.g. ["HSET", "key", "field", "value"]).
| Parameter | Type | Required | Description |
|---|
url | string | Yes | Redis connection URL (e.g. redis://user:password@host:port) |
command | string | Yes | Redis command as a JSON array (e.g. ["SET", "key", "value"]) |
| Parameter | Type | Description |
|---|
command | string | The command that was executed |
result | json | The result of the command |
Set a field in a hash stored at a key in Redis.
| 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 |
| 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) |
Get the value of a field in a hash stored at a key in Redis.
| 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 |
| 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 |
Get all fields and values of a hash stored at a key in Redis.
| Parameter | Type | Required | Description |
|---|
url | string | Yes | Redis connection URL (e.g. redis://user:password@host:port) |
key | string | Yes | The hash key |
| 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 |
Delete a field from a hash stored at a key in Redis.
| 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 |
| 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) |
Increment the integer value of a key by one in Redis.
| Parameter | Type | Required | Description |
|---|
url | string | Yes | Redis connection URL (e.g. redis://user:password@host:port) |
key | string | Yes | The key to increment |
| Parameter | Type | Description |
|---|
key | string | The key that was incremented |
value | number | The new value after increment |
Increment the integer value of a key by a given amount in Redis.
| 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) |
| Parameter | Type | Description |
|---|
key | string | The key that was incremented |
value | number | The new value after increment |
Set an expiration time (in seconds) on a key in Redis.
| 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 |
| 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 |
Get the remaining time to live (in seconds) of a key in Redis.
| 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 |
| 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. |
Remove the expiration from a key in Redis, making it persist indefinitely.
| Parameter | Type | Required | Description |
|---|
url | string | Yes | Redis connection URL (e.g. redis://user:password@host:port) |
key | string | Yes | The key to persist |
| Parameter | Type | Description |
|---|
key | string | The key that was persisted |
result | number | 1 if the expiration was removed, 0 if the key does not exist or has no expiration |
Prepend a value to a list stored at a key in Redis.
| Parameter | Type | Required | Description |
|---|
url | string | Yes | Redis connection URL (e.g. redis://user:password@host:port) |
key | string | Yes | The list key |
value | string | Yes | The value to prepend |
| Parameter | Type | Description |
|---|
key | string | The list key |
length | number | Length of the list after the push |
Append a value to the end of a list stored at a key in Redis.
| Parameter | Type | Required | Description |
|---|
url | string | Yes | Redis connection URL (e.g. redis://user:password@host:port) |
key | string | Yes | The list key |
value | string | Yes | The value to append |
| Parameter | Type | Description |
|---|
key | string | The list key |
length | number | Length of the list after the push |
Remove and return the first element of a list stored at a key in Redis.
| Parameter | Type | Required | Description |
|---|
url | string | Yes | Redis connection URL (e.g. redis://user:password@host:port) |
key | string | Yes | The list key |
| Parameter | Type | Description |
|---|
key | string | The list key |
value | string | The removed element, or null if the list is empty |
Remove and return the last element of a list stored at a key in Redis.
| Parameter | Type | Required | Description |
|---|
url | string | Yes | Redis connection URL (e.g. redis://user:password@host:port) |
key | string | Yes | The list key |
| Parameter | Type | Description |
|---|
key | string | The list key |
value | string | The removed element, or null if the list is empty |
Get the length of a list stored at a key in Redis.
| Parameter | Type | Required | Description |
|---|
url | string | Yes | Redis connection URL (e.g. redis://user:password@host:port) |
key | string | Yes | The list key |
| Parameter | Type | Description |
|---|
key | string | The list key |
length | number | The length of the list, or 0 if the key does not exist |
Get a range of elements from a list stored at a key in Redis.
| 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) |
| Parameter | Type | Description |
|---|
key | string | The list key |
values | array | List elements in the specified range |
count | number | Number of elements returned |
Check if a key exists in Redis.
| Parameter | Type | Required | Description |
|---|
url | string | Yes | Redis connection URL (e.g. redis://user:password@host:port) |
key | string | Yes | The key to check |
| Parameter | Type | Description |
|---|
key | string | The key that was checked |
exists | boolean | Whether the key exists (true) or not (false) |
Set the value of a key in Redis only if the key does not already exist.
| 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 |
| Parameter | Type | Description |
|---|
key | string | The key that was set |
wasSet | boolean | Whether the key was set (true) or already existed (false) |