Key-Value Storage icon

Key-Value Storage

Key-Value Storage Getter and Setter

Set Value for Key in Scope

AI-generated

Overview

This node operation sets a value for a specified key within a defined scope in a key-value storage system. It is useful for storing data that needs to be accessed or shared across different parts of a workflow, execution, or instance. For example, you can store a temporary token, configuration setting, or any other data that should persist for a certain time or until explicitly changed.

Use Case Examples

  1. Storing a user session token in the Execution scope to be used by subsequent nodes.
  2. Saving a configuration parameter in the Workflow scope that multiple executions can access.
  3. Setting a global flag in the Instance scope to control behavior across workflows.

Properties

Name Meaning
Scope Defines the scope in which the key-value pair will be stored. Options include ALL Scopes, Execution Scope, Workflow Scope, and Instance Scope.
Key The key under which the value will be stored.
Value The value to be stored for the specified key.
Expire Determines whether the key should have a timeout (expiration).
TTL The time-to-live in seconds before the key expires, applicable only if expiration is enabled.

Output

JSON

  • key - The key for which the value was set.
  • value - The value that was stored.
  • scope - The scope in which the key-value pair was stored.
  • expiration - The expiration time or TTL set for the key, if applicable.

Dependencies

  • Requires a key-value storage service accessible via the node's internal KvStorageService.

Troubleshooting

  • Ensure the key is provided and is a valid string; missing or empty keys will cause errors.
  • If using Execution scope, ensure the executionId is correctly set and corresponds to the current execution context.
  • If expiration is enabled, TTL must be a positive number; invalid TTL values may cause the operation to fail.

Discussion