API reference › @evolu/common › Resource › SharedResourceByKeyWithClaimsOptions
Defined in: packages/common/src/Resource.ts:1320
Options for createSharedResourceByKeyWithClaims.
Extends
Pick<SharedResourceOptions,"idleDisposeAfter">
Properties
claimLookup?
readonly optional claimLookup?: Lookup<C, LC>;
Defined in: packages/common/src/Resource.ts:1331
Derives the identity used to compare claims.
idleDisposeAfter?
readonly optional idleDisposeAfter?: PositiveDuration;
Defined in: packages/common/src/Resource.ts:304
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
onFirstClaimAdded?
readonly optional onFirstClaimAdded?: (claim: C, resource: DistributiveOmit<T>, resourceKey: K) => void;
Defined in: packages/common/src/Resource.ts:1341
Called when a claim-resource pair transitions from zero retains to one.
This is a pair-retain transition, not a resource-generation transition: a resource can already be retained by other claims or be idling after an earlier release. Arguments use the first stored representatives for their logical claim and key.
onLastClaimRemoved?
readonly optional onLastClaimRemoved?: (claim: C, resource: DistributiveOmit<T>, resourceKey: K) => void;
Defined in: packages/common/src/Resource.ts:1357
Called when a claim-resource pair transitions from one retain to zero.
Runs before the ClaimLease's inner resource lease is released. Other claims can still retain the same resource. Arguments use the first stored representatives for their logical claim and key. During normal release, the current pair and earlier keys from the same ClaimLease are already absent from relation reads; later keys remain. During compensation for a failed first-claim callback, the failed claim remains fully visible.
resourceLookup?
readonly optional resourceLookup?: Lookup<K, LK>;
Defined in: packages/common/src/Resource.ts:1328
Derives the identity used to compare resource keys.