Skip to main content

Cache nodes New

Cache nodes store a value for the duration of a workflow, or longer, so a later node can read it. The Cache group in the editor contains three nodes: Write to cache, Read from cache and Delete from cache.

Parameters​

ParameterTypeRequiredDefaultDescription
AppApp❌—Application associated with the node.
ConnectionManaged cache / Your own instance❌Managed cacheCache provided by Apizr, or your Redis.
KeyText✅—Identifies the entry. Accepts a Handlebars template. A key that resolves to an empty string stops the node.
ValueText❌—Write to cache only. Stored value: Handlebars template, JSON, number, boolean, object or array.
TTL (seconds)Number❌No TTLWrite to cache only. Time to live. Empty: the key does not expire. The form says so.
Cipher valueBoolean❌OffWrite to cache only. The value is ciphered before it is stored.
Decipher valueBoolean❌OffRead from cache only. Must match the setting used when writing.
Output keyText❌cacheResultName under which the result is stored in the context.
Timeout (seconds)Number❌5Maximum duration of the Redis call, from 1 to 30 seconds.
Stop workflow on failureBoolean❌OnOn a read, a missing key stops the branch. Off, the node succeeds and found is false.

Connection​

  • Managed cache: the cache provided by the platform. The form shows the quotas: 50 MB of storage for all workflows of the company, 256 characters for the key, 64 KB for the value. These quotas do not apply to your own instance.
  • Your own instance: your Redis.
FieldDefaultDescription
Host—Redis address. Accepts a Handlebars template.
Port6379Listening port.
Enable TLSOffEncrypts the connection.
Authentication methodUser / PasswordUser / Password, or Credentials (an Ecosystem authentication method).

Key, value and TTL​

The key and the value accept Handlebars templates, for example {{context.cacheKey}} and {{context.token}}.

Without a TTL, the key does not expire. The form warns that entries then stay indefinitely and can fill the managed cache quota.

Ciphering is optional on write. Read must use the same setting, otherwise the data is not deciphered.

Output key​

The result is placed in the context under the output key. By default, cacheResult. From a following node: {{context.cacheResult.value}}.

Input​

Write a value:

{
"context": {
"customerId": "42",
"token": "abc"
}
}

Key: token:{{context.customerId}}. Value: {{context.token}}. TTL: 60.

Output​

Write to cache:

{
"cacheResult": {
"key": "token:42",
"set": true,
"ttlSeconds": 60
}
}

Without a TTL, ttlSeconds is null.

Read from cache, key present:

{
"cacheResult": {
"key": "token:42",
"found": true,
"value": "abc"
}
}

Read from cache, key missing and Stop workflow on failure off:

{
"cacheResult": {
"key": "token:42",
"found": false
}
}

Delete from cache:

{
"cacheResult": {
"key": "token:42",
"deleted": true
}
}

Errors​

  • A key that resolves to an empty string stops the node (Workflow cache key resolved to an empty value).
  • A read whose key is missing, with stop on failure on, stops the branch (Workflow cache key not found).
  • Exceeding a managed cache quota (store size, key length, value size) fails the operation.

Limits​

Managed cache, values shown in the form:

  • 50 MB of storage for all workflows of the company
  • 256 characters for the key
  • 64 KB for the value

The Redis call timeout is from 1 to 30 seconds, 5 by default. Your own instance is not subject to these quotas.

Example​

A workflow receives a token, writes it, then reads it on a later step.

  1. Write to cache. Key token:{{context.customerId}}, value {{context.token}}, TTL 60, connection Managed cache.
  2. Read from cache. Same key. The next node reads {{context.cacheResult.value}}.

See also​