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.
Implements
Section titled “Implements”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new MemoryIdempotencyStore(
options?):MemoryIdempotencyStore
Defined in: packages/pipeline-idempotency/src/stores/memory.store.ts:38
Parameters
Section titled “Parameters”options?
Section titled “options?”Returns
Section titled “Returns”MemoryIdempotencyStore
Accessors
Section titled “Accessors”Get Signature
Section titled “Get Signature”get size():
number
Defined in: packages/pipeline-idempotency/src/stores/memory.store.ts:52
Current number of active (stored) entries.
Returns
Section titled “Returns”number
Methods
Section titled “Methods”cleanupExpired()
Section titled “cleanupExpired()”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.
Returns
Section titled “Returns”number
completeIfOwned()
Section titled “completeIfOwned()”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.
Parameters
Section titled “Parameters”string
claimId
Section titled “claimId”string
record
Section titled “record”number
Returns
Section titled “Returns”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.
Implementation of
Section titled “Implementation of”IdempotencyStore.completeIfOwned
delete()
Section titled “delete()”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.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”deleteIfOwned()
Section titled “deleteIfOwned()”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.
Parameters
Section titled “Parameters”string
claimId
Section titled “claimId”string
Returns
Section titled “Returns”boolean
Implementation of
Section titled “Implementation of”IdempotencyStore.deleteIfOwned
destroy()
Section titled “destroy()”destroy():
void
Defined in: packages/pipeline-idempotency/src/stores/memory.store.ts:73
Stops the periodic cleanup timer and releases timer resources.
Returns
Section titled “Returns”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.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”IdempotencyRecord | undefined
Implementation of
Section titled “Implementation of”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.
Parameters
Section titled “Parameters”string
record
Section titled “record”number
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”setIfAbsent()
Section titled “setIfAbsent()”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.
Parameters
Section titled “Parameters”string
record
Section titled “record”number
Returns
Section titled “Returns”boolean
true if the key was claimed by this call, false if a live
record already existed.