Skip to content

LocalDataStore.getOrCreate method

LocalDataStore › getOrCreate

Initializes a record once, atomically across connections.

Signature:

getOrCreate(key: string, value: unknown): Promise<unknown>

Parameters:

ParameterTypeDescription
keystringRecord key.
valueunknownValue used only when the key is absent.

Returns: Promise<unknown> — The existing or newly committed value.