Overview
This node implements a simple in-memory key-value datastore within the n8n instance. It allows users to store, retrieve, and clear data by keys during workflow execution. The data is kept in memory and shared across executions of this node, enabling temporary data sharing or caching without external dependencies.
Common scenarios include:
- Caching API responses temporarily to avoid repeated calls.
- Sharing intermediate data between different parts of a workflow.
- Storing configuration or state information dynamically during workflow runs.
For example, you can use the "Set" operation to save a JSON object under a specific key, then later use the "Get" operation to retrieve it for conditional logic or further processing.
Properties
| Name | Meaning |
|---|---|
| Key Name | The unique key identifier for storing or retrieving data. |
| Value Data Type | The type of data to store as the value. Options: String, JSON. |
| Value (String) | The string value to store when Value Data Type is set to String. |
| Value (JSON) | The JSON value to store when Value Data Type is set to JSON. |
| Output for Set/Clear | Defines what the node outputs after a Set or Clear operation. Options: |
| - Pass Through: Outputs the same input data unchanged. | |
| - Output Key: Outputs only status, operation, and key. | |
| - Output Value: Outputs only status, operation, and saved value. | |
| - Output Key-Value: Outputs only the key-value pair. |
Output
The node outputs an array of items with a json field structured depending on the operation and output option:
Set Operation:
- If multiple items are processed with the same key and JSON data type, the stored value is an array of JSON objects.
- Output can be:
- Full pass-through of input items.
- Status summary with success flag, operation name, key, and optionally item count.
- The saved value(s) associated with the key.
- Only the key-value pair stored.
Get Operation:
- Outputs each found value with fields:
key,value, andfound(boolean). - If the stored value is an array, each element is output as a separate item.
- If the key is not found, outputs
value: nullandfound: false.
- Outputs each found value with fields:
Clear Operation:
- Outputs status including success, operation, key, and whether the key was cleared.
- Optionally outputs the affected value before clearing if requested.
Clear All Operation:
- Clears all stored data.
- Outputs success status and operation name.
The node does not output binary data.
Dependencies
- No external services or APIs are required.
- The node uses an internal static Map object to store data in memory.
- No special environment variables or credentials are needed.
Troubleshooting
- Missing Key Name: For operations that require a key (
set,get,clear), omitting the key will cause an error indicating the key is required. - Invalid JSON Input: When setting a value with JSON data type, invalid JSON strings will cause errors specifying which item failed and why.
- Mixed Keys or Data Types in Batch: When processing multiple items in one execution with the
setoperation, all items must have the same key and data type to store them as an array; otherwise, they are processed individually. - Unknown Data Type: Setting a value with an unsupported data type will throw an error.
- Data Persistence: Since the storage is in-memory, all data is lost if the n8n instance restarts.
To resolve these issues:
- Always provide a valid key name.
- Validate JSON inputs before running the workflow.
- Use consistent keys and data types when batch processing.
- Understand that data is ephemeral and not persisted beyond runtime.