Skip to main content

Local Storage

1. Overview

The Local Storage component (local-storage) works like a small in-memory data "vault", storing key/value pairs for reuse elsewhere in the flow. It has two lifetime modes (scopes): data that only exists during the current run, or data shared across different runs of the application, with an expiration time.

Use it when you need to temporarily store a value for later use in the same flow, or when you need to share information across different runs (for example, a simple cache or a counter). Don't use it for permanent storage or large volumes of data — that should go to a real database.

2. Prerequisites

No external credentials. Internally, the "shared across runs" scope uses a distributed in-memory storage instance (Hazelcast), created automatically by the platform on first use — no manual configuration required.

3. Authentication and Connection

Not applicable — there's no user-configurable connection to external systems.

4. Configuration / Supported Operations

The component supports three operations, controlled by the operation field.

FieldRequiredTypeDescriptionExample
operationNoText: GET, PUT, or DELETEOperation to run. Default value: GET. Any unrecognized value is treated as GET."PUT"
scopeNoText: EXECUTION or APPLICATIONDefines the data's reach. EXECUTION (default): the value only exists during the current flow run. APPLICATION: the value is shared across different runs, with an expiration time."APPLICATION"
keyYesExpressionKey used to store/fetch/delete the value."orderCounter"
valueYes (for PUT)ExpressionValue to be stored. Only used in the PUT operation."10"
expirationNoText (milliseconds)Lifetime of the value, applicable only to APPLICATION scope. Default value: "600000" (10 minutes)."3600000" (1 hour)

Behavior by operation:

  • GET: fetches the value for the given key. If it doesn't exist, returns an empty body (doesn't raise an error).
  • PUT: stores the value under the given key. In APPLICATION scope, applies the configured expiration time.
  • DELETE: removes the value under the given key, if it exists.

Error behavior: if key isn't informed, execution fails with the error "Missing key. Please specify a key to LocalStorage."

5. Practical Examples

Simple example: within a single flow run, one component stores the customer's tax ID under a key (operation: PUT, scope: EXECUTION), and a component further down the same flow retrieves that value (operation: GET) without needing to fetch it again from the source.

Input:

{
"customer": { "taxId": "123.456.789-00" }
}

Component configuration (storing the value):

{
"componentName": "local-storage",
"configurations": {
"operation": "PUT",
"scope": "EXECUTION",
"key": "customerTaxId",
"value": "{$.body.customer.taxId}"
}
}

Component configuration (reading the value further down the same flow):

{
"componentName": "local-storage",
"configurations": {
"operation": "GET",
"scope": "EXECUTION",
"key": "customerTaxId"
}
}

GET response (the message body becomes the stored value):

"123.456.789-00"

Advanced example: a processing-attempt counter needs to be shared across different flow runs (for example, to limit how many times the same order can be reprocessed in a given period). In this case, scope: APPLICATION is used with a one-hour expiration time (expiration: "3600000"), ensuring the counter expires automatically after that period even without being explicitly deleted.

Component configuration:

{
"componentName": "local-storage",
"configurations": {
"operation": "PUT",
"scope": "APPLICATION",
"key": "attempts-order-981",
"value": "1",
"expiration": "3600000"
}
}

Response:

"1"

6. Points of Attention

  • EXECUTION scope doesn't survive the end of the run — the data disappears when the flow finishes.
  • APPLICATION scope stays in memory; if the application restarts, the data is lost even before expiring.
  • Values are treated as plain text, with no native support for complex structures.
  • Suited for temporary data at a moderate volume, not for permanent storage or large volumes.

7. Common Errors and Troubleshooting

Error / SymptomLikely CauseHow to Fix
"Missing key. Please specify a key to LocalStorage."The key field wasn't filled in.Fill in key with a valid value for any of the three operations.
Value always empty when using GETThe key was never stored before, or the value expired (in APPLICATION scope), or it was stored under a different scope than the one used for reading.Confirm the scope used in GET matches the one used in PUT, and that the data hasn't expired yet.
Data expected from PUT doesn't show up in another runscope: EXECUTION was used, which doesn't persist across runs.Use scope: APPLICATION to share data across different runs.