Skip to main content

Revoke-ZrLease

Revokes a lease and removes every item bound to it. A fast way to expire a group of related keys at once.

Syntax

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

Description

Revoke-ZrLease revokes the lease identified by the given lease id on the connected Zaris store. Revoking a lease immediately deletes all keys that were written under it, so it is commonly used to release a distributed lock, drop leader-election ownership, or clean up a set of coordinated entries in a single call.

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

Parameters

ParameterTypeRequiredDescription
-LeaseIdLeaseIdYesThe identifier of the lease to revoke. 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, Revoked, Success, and Error.

Examples

Revoke a lease and delete all items associated with it:

Revoke-ZrLease -LeaseId $lease

Release a lease held for leader election during shutdown:

Revoke-ZrLease -LeaseId $leaderLease