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 unique keys during workflow execution. This is useful for sharing data between different parts of a workflow or across multiple executions without relying on external databases.
Common scenarios include:
- Temporarily caching API responses or computed values to reuse later in the workflow.
- Sharing state or flags between different nodes or executions.
- Clearing stored data when no longer needed to free memory.
For example, you can use the "Set" operation to save a JSON object under a key, then later use the "Get" operation to retrieve it and branch your workflow based on its contents.
Properties
| Name | Meaning |
|---|---|
| Key Name | The unique key for the data. Used to identify the stored value for get, set, or clear operations. |
Note: Although the bundled code supports other operations like "set", "clear", and "clearAll", the provided properties only define "Key Name" relevant for "get", "set", and "clear" operations.
Output
The output JSON structure varies depending on the operation:
Get Operation
Outputs an object with:{ "key": "<keyName>", "value": <storedValue or null>, "found": true|false }If the key exists,
foundistrueandvaluecontains the stored data (which can be any JSON type or array). If not found,foundisfalseandvalueisnull.Set Operation
Depending on the configured output mode, outputs one of:- Status:
{ "success": true, "operation": "set", "key": "<keyName>" } - Affected Value:
{ "success": true, "operation": "set", "value": <storedValue> } - Affected Value Only:
{ "<keyName>": <storedValue> } - Pass-through: Outputs the original input item unchanged.
- Status:
Clear Operation
Similar output modes as "set", indicating success and whether the key was cleared.Clear All Operation
Outputs a success status indicating all keys were cleared.
No binary data output is produced by this node.
Dependencies
- No external services or APIs are required.
- The node uses an internal static Map object to store data in memory.
- No special credentials or environment variables are needed.
Troubleshooting
Missing Key Name:
Error messages like"Key Name is required for 'Get' operation."indicate that the key name parameter was not provided. Ensure the "Key Name" property is set for operations that require it.Invalid JSON Input (for "Set" operation with JSON data type):
Errors such as"Invalid JSON provided for key ..."mean the JSON string entered is malformed. Validate and correct the JSON syntax.Unknown Data Type:
If a data type other than "string" or "json" is specified, the node throws an error. Use only supported data types.Multiple Items with Different Keys or Types:
When setting multiple items at once, all must have the same key and data type if using JSON arrays; otherwise, the node processes items individually.Data Persistence:
Since the datastore is in-memory, all stored data will be lost if the n8n instance restarts.