Skip to main content

PromiseCache Class

A specialized cache for async work, allowing you to safely cache the promised result of some async work without fear of running it multiple times or losing track of errors.

This API is provided for existing users, but is not recommended for new users.

To use, import via @fluidframework/core-utils/legacy.

For more information about our API support guarantees, see here.

Signature

export declare class PromiseCache<TKey, TResult>

Type Parameters

Parameter Description
TKey
TResult

Constructors

Constructor Alerts Description
(constructor)({ expiry, removeOnError, }) Alpha

Create the PromiseCache with the given options, with the following defaults:

expiry: indefinite, removeOnError: true for all errors

Constructor Details

(constructor)

Create the PromiseCache with the given options, with the following defaults:

expiry: indefinite, removeOnError: true for all errors

This API is provided for existing users, but is not recommended for new users.

For more information about our API support guarantees, see here.

Signature

constructor({ expiry, removeOnError, }?: PromiseCacheOptions);

Parameters

Parameter Modifiers Type Description
{ expiry, removeOnError, } optional PromiseCacheOptions