Skip to content

MemoryIdempotencyStore

Defined in: packages/pipeline-idempotency/src/stores/memory.store.ts:33

Zero-dependency, in-process IdempotencyStore backed by a Map with per-entry expiry and bounded memory capacity. The default store — ideal for a single instance, tests, or local development.

Because Node runs JavaScript on a single thread, setIfAbsent, completeIfOwned, and deleteIfOwned are effectively atomic here. State is not shared across processes, so for a multi-instance deployment use RedisIdempotencyStore or PostgresIdempotencyStore.

new MemoryIdempotencyStore(options?): MemoryIdempotencyStore

Defined in: packages/pipeline-idempotency/src/stores/memory.store.ts:38

MemoryIdempotencyStoreOptions

MemoryIdempotencyStore

get size(): number

Defined in: packages/pipeline-idempotency/src/stores/memory.store.ts:52

Current number of active (stored) entries.

number

cleanupExpired(): number

Defined in: packages/pipeline-idempotency/src/stores/memory.store.ts:60

Iterates through all entries and removes any whose TTL has elapsed. Returns the count of deleted entries.

number


completeIfOwned(key, claimId, record, ttlMs): boolean

Defined in: packages/pipeline-idempotency/src/stores/memory.store.ts:105

Atomically replaces the live in_progress record with record only when the existing record is still owned by claimId.

string

string

IdempotencyRecord

number

boolean

true when this claim completed its own record; false when the claim expired, was replaced, or was otherwise no longer owned by the caller.

IdempotencyStore.completeIfOwned


delete(key): void

Defined in: packages/pipeline-idempotency/src/stores/memory.store.ts:138

Unconditional delete for administrative or custom use. Pipeline failure release uses deleteIfOwned, not this method.

string

void

IdempotencyStore.delete


deleteIfOwned(key, claimId): boolean

Defined in: packages/pipeline-idempotency/src/stores/memory.store.ts:123

Atomically removes the live record only when it is still owned by claimId. Used by releaseOnError so a stale failure cannot delete a newer execution’s claim.

string

string

boolean

IdempotencyStore.deleteIfOwned


destroy(): void

Defined in: packages/pipeline-idempotency/src/stores/memory.store.ts:73

Stops the periodic cleanup timer and releases timer resources.

void


get(key): IdempotencyRecord | undefined

Defined in: packages/pipeline-idempotency/src/stores/memory.store.ts:91

Returns the live (non-expired) record for key, or undefined if there is none.

string

IdempotencyRecord | undefined

IdempotencyStore.get


set(key, record, ttlMs): void

Defined in: packages/pipeline-idempotency/src/stores/memory.store.ts:131

Unconditional overwrite for administrative or custom use. Pipeline execution completion uses completeIfOwned, not this method.

string

IdempotencyRecord

number

void

IdempotencyStore.set


setIfAbsent(key, record, ttlMs): boolean

Defined in: packages/pipeline-idempotency/src/stores/memory.store.ts:96

Atomically stores record only if no live record exists for key.

string

IdempotencyRecord

number

boolean

true if the key was claimed by this call, false if a live record already existed.

IdempotencyStore.setIfAbsent