Skip to main content

Refresh-ZrLease

Keeps a lease alive by resetting its time-to-live. Run it periodically so items bound to the lease do not expire.

Syntax

Refresh-ZrLease [-LeaseId] <LeaseId> [-ConnectionString <string>] [-StoreName <string>] [-Endpoints <string[]>] [-TimeoutSec <int>]

Description

Refresh-ZrLease sends a keep-alive for the given lease id on the connected Zaris store, restarting the lease's TTL countdown. As long as the lease is refreshed before its TTL elapses, keys attached to it remain in the store. If the lease has already expired or is invalid, the operation reports failure in its result object.

The cmdlet requires an active connection (Connect-ZrStore) or a one-shot independent connection supplied through -StoreName and -Endpoints.

Parameters

ParameterTypeRequiredDescription
-LeaseIdLeaseIdYesThe id of the lease to keep alive. Positional (position 0).
-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 Connect-ZrStore context. Belongs to the Independent parameter set; use together with -Endpoints.
-EndpointsString[]NoOne or more store node endpoints (host:port) for an independent connection. Only the first endpoint is used as the seed. Ignored when a Connect-ZrStore session is active.
-TimeoutSecInt32NoConnection timeout, in seconds, for an independent connection. Range 1–120. Default 5.

Returns an object with LeaseId, Success, and Error.

Examples

Keep an active lease alive, resetting its expiry countdown:

Refresh-ZrLease -LeaseId $lease

Renew a lease on a fixed cadence from a script:

while ($true) {
Refresh-ZrLease -LeaseId $lease | Out-Null
Start-Sleep -Seconds 10
}