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
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| App | App | ❌ | — | Application associated with the node. |
| Connection | Managed cache / Your own instance | ❌ | Managed cache | Cache provided by Apizr, or your Redis. |
| Key | Text | ✅ | — | Identifies the entry. Accepts a Handlebars template. A key that resolves to an empty string stops the node. |
| Value | Text | ❌ | — | Write to cache only. Stored value: Handlebars template, JSON, number, boolean, object or array. |
| TTL (seconds) | Number | ❌ | No TTL | Write to cache only. Time to live. Empty: the key does not expire. The form says so. |
| Cipher value | Boolean | ❌ | Off | Write to cache only. The value is ciphered before it is stored. |
| Decipher value | Boolean | ❌ | Off | Read from cache only. Must match the setting used when writing. |
| Output key | Text | ❌ | cacheResult | Name under which the result is stored in the context. |
| Timeout (seconds) | Number | ❌ | 5 | Maximum duration of the Redis call, from 1 to 30 seconds. |
| Stop workflow on failure | Boolean | ❌ | On | On 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.
| Field | Default | Description |
|---|---|---|
| Host | — | Redis address. Accepts a Handlebars template. |
| Port | 6379 | Listening port. |
| Enable TLS | Off | Encrypts the connection. |
| Authentication method | User / Password | User / 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.
- Write to cache. Key
token:{{context.customerId}}, value{{context.token}}, TTL60, connection Managed cache. - Read from cache. Same key. The next node reads
{{context.cacheResult.value}}.