Skip to main content

Set-ZrItems

Writes multiple items to the connected Zaris store in a single batched put, creating or overwriting each item and emitting one result record per key.

Syntax

Set-ZrItems [-Items] <IDictionary>
[-ConnectionString <string>] [-StoreName <string>] [-Endpoints <string[]>] [-TimeoutSec <int>]
[-WhatIf] [-Confirm]

Description

Set-ZrItems stores every key/value pair from the supplied dictionary using one bulk request. It requires an active connection opened with Connect-ZrStore, or the independent -StoreName/-Endpoints parameters for a one-shot connection.

Dictionary keys must be non-null and non-empty. The cmdlet supports ShouldProcess, so -WhatIf and -Confirm are available. Press Ctrl+C to cancel safely. Bulk writes are more efficient than issuing individual Set-ZrItem calls.

Each returned object has StoreName, Key, IsUpdate, Revision, Version, Success, and Error.

Parameters

ParameterTypeRequiredDescription
-ItemsIDictionaryYesA dictionary of key/value pairs to store. Position 0. Accepts pipeline input (ValueFromPipeline). Must be non-null; keys must be non-null and non-empty.
-ConnectionStringStringNoConnect via a Zaris connection string, e.g. zaris://host:7861/store; an alternative to -StoreName + -Endpoints for a one-shot connection. Ignored when a Connect-ZrStore session is active.
-StoreNameStringNoStore to operate on for a one-shot (independent) connection instead of the active session. Requires -Endpoints; ignored when a Connect-ZrStore session is active.
-EndpointsString[]NoOne or more host:port endpoints for a one-shot connection. Ignored when a session is active.
-TimeoutSecInt32NoConnection timeout in seconds for a one-shot connection. Range 1–120. Default 5.

Supports the -WhatIf and -Confirm common parameters via ShouldProcess.

Examples

Write several items in one bulk call:

Set-ZrItems -Items @{
"user:1" = "Alice"
"user:2" = "Bob"
"user:3" = "Charlie"
}

Pipe a dictionary into the cmdlet:

$items = @{
"session:1" = "abc"
"session:2" = "xyz"
}
$items | Set-ZrItems