# State

## .qsp.get¶

Retrieves state for the current operator. If no operator configuration is provided, state is retrieved from global storage.

Parameters:

Name Type Description
op #.sp.op | symbol Optionally the operator configuration or the explicit name of the operator. To have the operator configuration provided to the body of an operator function, set the following configuration with .qsp.use. .qsp.use enlist[params]!enlist context
md #.qsp.metadata | null Optionally pass the metadata for specialized data storage and retrieval. Passing metadata will allow for data to be stored on a per-key basis which allows for dynamic rebalancing of state across workers.

Returns:

Type Description
any Cached state.

## .qsp.set¶

Stores state for the current operator. If no operator configuration is provided, state is retrieved from global storage.

Parameters:

Name Type Description
op #.sp.op | symbol Optionally the operator configuration or the explicit name of the operator. To have the operator configuration provided to the body of an operator function, set the following configuration with .qsp.use. .qsp.use enlist[params]!enlist context
md #.qsp.metadata | null Optionally pass the metadata for specialized data storage and retrieval. Passing metadata will allow for data to be stored on a per-key basis which allows for dynamic rebalancing of state across workers.
data any Data to be added to state.

Returns:

Type Description
any Data added to the state.