API reference@evolu/commonResource › SharedResourceByKeyOptions

Defined in: packages/common/src/Resource.ts:675

Options for createSharedResourceByKey.

Extends

Properties

idleDisposeAfter?

readonly optional idleDisposeAfter?: PositiveDuration;

Defined in: packages/common/src/Resource.ts:283

Keeps the resource alive briefly after the last lease is released.

This avoids immediate disposal when the resource is expensive to create and likely to be acquired again soon. A new acquire during this delay cancels the pending disposal and reuses the current resource.

Inherited from

SharedResourceOptions.idleDisposeAfter


lookup?

readonly optional lookup?: Lookup<K, L>;

Defined in: packages/common/src/Lookup.ts:44

Derives the lookup key used for logical equality.

Inherited from

LookupOption.lookup


onDisposed?

readonly optional onDisposed?: (key: K) => void;

Defined in: packages/common/src/Resource.ts:687

Called with key after each current resource for that key is disposed, including during SharedResourceByKey disposal. Not called for keys whose resources were never created.

After ordinary idle disposal, the key is removed before this callback unless a same-key operation is already in progress. A regular acquire can then create the next current resource. An acquireCurrent that finds no resource removes the retained key before returning.