Skip to main content

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, no CONFIG).

Configuration​

SettingRequiredNotes
Connection stringyesStackExchange.Redis format: host:port,password=…,ssl=True. Azure: Access keys → Primary connection string. Stored securely.
DatabasenoLogical database index (SELECT), 0–255. Empty: 0.
Key prefixnoPut 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)noConnect 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 error flow.

Redis Key​

One plain key.

OperationFieldsOutput
GetKey, Parse JSON (advanced)The value, or null when missing.
SetKey, Value, Write (Always / Only if missing / Only if present), Expire aftertrue when written; false when Only if missing found the key (or Only if present did not).
DeleteKeytrue when the key existed.
ExistsKeytrue / false.
IncrementKey, 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.
ExpireKey, Expire aftertrue when the key existed.
Time to liveKeySeconds 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).

OperationFieldsOutput
Get fieldKey, Field, Parse JSON (advanced)The field's value, or null.
Set fieldKey, Field, Value, Expire aftertrue when the field was new, false when overwritten.
Set fields from JSONKey, Fields (a JSON object), Expire afterNumber of fields written.
Get allKey, Parse JSON (advanced)The hash as an object: {user.name}, {user.plan}. Empty object when missing.
Delete fieldKey, Fieldtrue when the field existed.
Increment fieldKey, Field, Amount, Expire afterThe new number.
Field existsKey, Fieldtrue / 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.

OperationFieldsOutput
PushKey, Value, Side (Right / Left), Expire afterThe list length after the push.
PopKey, Side, Parse JSON (advanced)The element taken, or null when the list is empty.
RangeKey, Start (empty: 0), Stop (empty: -1, the end; negative counts from the end), Parse JSONThe elements as a list (at most 10000; a warning says when more were cut).
LengthKeyThe length (0 when missing).
RemoveKey, ValueHow 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.

OperationFieldsOutput
AddKey, Member, Expire aftertrue the first time the member is added, false when it was already there.
RemoveKey, Membertrue when the member was there.
ContainsKey, Membertrue / false.
MembersKeyThe members as a list (at most 10000).
CountKeyHow 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.

PropertyNotes
ChannelExactly as the subscribers listen to it. The key prefix is not added.
MessageText 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.