Redis Module
Read and write a Redis server from a workflow: keys with expiry, counters, hashes, lists, sets and Pub/Sub messages, on the server you configure per environment.
Typical uses: remember something between runs (the last id handled, a user's preferences), count and rate-limit (calls per hour per customer), take a lock so two runs never process the same order twice, queue work for another system, skip duplicates, or notify a service that listens on a Redis channel.
Requirements
- A Redis server the engine can reach (Azure Cache for Redis, Redis Cloud, or your own, 6.0 or newer). TLS is supported (
ssl=True). - The server's connection string. The module never runs admin commands (no
FLUSH, noCONFIG).
Configuration
| Setting | Required | Notes |
|---|---|---|
| Connection string | yes | StackExchange.Redis format: host:port,password=…,ssl=True. Azure: Access keys → Primary connection string. Stored securely. |
| Database | no | Logical database index (SELECT), 0–255. Empty: 0. |
| Key prefix | no | Put in front of every key, e.g. shop:prod:. Give each environment its own prefix when they share a server. Not applied to hash fields or Pub/Sub channels. |
| Timeout (seconds) | no | Connect and command timeout, 1–60. Empty: 5. |
The connection is opened once per server and shared by every run. When the server is down the task fails with a could not connect error on its error flow; the next run tries again.
Common to every task
- Keys are text and may hold
{variables}:cart:{userId}. The prefix is added for you. - Values are text. A
{variable}holding an object is written as its JSON; read it back with Parse JSON on and later steps use{result.field}. Text that is not JSON stays text (so"42"is still"42"). - Expire after (seconds) on a write makes the whole key disappear after that time (1 second to ten years). Empty leaves the expiry as it is.
- Every task writes one Output variable; the value depends on the operation (listed below). A missing key or field reads as
null. - Errors: a bad input fails the task with TaskInvalidData; a server that is down, a timeout, a wrong password or a key holding another kind of value (e.g. a list where a string was expected) fail it with ModuleException. Route the
errorflow.
Redis Key
One plain key.
| Operation | Fields | Output |
|---|---|---|
| Get | Key, Parse JSON (advanced) | The value, or null when missing. |
| Set | Key, Value, Write (Always / Only if missing / Only if present), Expire after | true when written; false when Only if missing found the key (or Only if present did not). |
| Delete | Key | true when the key existed. |
| Exists | Key | true / false. |
| Increment | Key, Amount (empty: 1; negative subtracts; 0.5 makes it a float) | The new number. A missing key starts at 0; a key holding text fails. |
| Expire | Key, Expire after | true when the key existed. |
| Time to live | Key | Seconds left; -1 when the key never expires; null when missing. |
Lock: Set with Write = Only if missing and an expiry. The output is true for the run that got the lock and false for the others; the expiry frees it if the run dies.
Rate limit: Increment calls:{customer}:{hour} then Expire it (or check the result against your limit with a Switch).
Redis Hash
One key holding named fields, like a record (user:42 → name, email, plan).
| Operation | Fields | Output |
|---|---|---|
| Get field | Key, Field, Parse JSON (advanced) | The field's value, or null. |
| Set field | Key, Field, Value, Expire after | true when the field was new, false when overwritten. |
| Set fields from JSON | Key, Fields (a JSON object), Expire after | Number of fields written. |
| Get all | Key, Parse JSON (advanced) | The hash as an object: {user.name}, {user.plan}. Empty object when missing. |
| Delete field | Key, Field | true when the field existed. |
| Increment field | Key, Field, Amount, Expire after | The new number. |
| Field exists | Key, Field | true / false. |
Set fields from JSON takes an object such as {"name":"{name}","visits":1,"vip":true,"old":null}: put {variables} inside string values (they are escaped so a quote in a name cannot break the document); numbers and booleans are stored as text; a nested object or array is stored as its JSON; null deletes that field.
Redis List
An ordered sequence under one key: a queue, a stack or a log.
| Operation | Fields | Output |
|---|---|---|
| Push | Key, Value, Side (Right / Left), Expire after | The list length after the push. |
| Pop | Key, Side, Parse JSON (advanced) | The element taken, or null when the list is empty. |
| Range | Key, Start (empty: 0), Stop (empty: -1, the end; negative counts from the end), Parse JSON | The elements as a list (at most 10000; a warning says when more were cut). |
| Length | Key | The length (0 when missing). |
| Remove | Key, Value | How many elements equal to Value were removed. |
Push Right + Pop Left is a queue (first in, first out); Push Right + Pop Right is a stack. Pop is atomic: two runs never take the same element.
Redis Set
Distinct members under one key, in no order: ids already handled, a user's tags.
| Operation | Fields | Output |
|---|---|---|
| Add | Key, Member, Expire after | true the first time the member is added, false when it was already there. |
| Remove | Key, Member | true when the member was there. |
| Contains | Key, Member | true / false. |
| Members | Key | The members as a list (at most 10000). |
| Count | Key | How many members. |
Skip duplicates: Add seen:orders with {orderId} and route on the output: false means this order was already processed.
Redis Publish
Sends one message on a channel (PUBLISH). Whoever is subscribed at that moment receives it; nothing is stored, so with no subscriber the message is gone. Use a List Push instead when the receiver may be offline.
| Property | Notes |
|---|---|
| Channel | Exactly as the subscribers listen to it. The key prefix is not added. |
| Message | Text or a {variable} (an object is sent as JSON). |
Output: how many subscribers received the message.
Limits
- Keys, fields and channel names: up to 1024 characters after the prefix.
- Values and JSON documents: up to 1 MB.
- Range and Members: at most 10000 elements are returned.