Open sandboxFocus

Method GetItemAsync

GetItemAsync(string, bool, CancellationToken)

Asynchronously gets a cache item given its key.

Declaration
public ValueTask<CacheItem?> GetItemAsync(string key, bool includeDependencies = false, CancellationToken cancellationToken = default)
Parameters
Type Name Description
string key

The cache item.

bool includeDependencies

true if the Dependencies property of the resulting CacheItem must be populated. When false, a backend may populate it anyway, so the caller must not assume that it is empty.

CancellationToken cancellationToken

A CancellationToken.

Returns
Type Description
ValueTask<CacheItem>

A Task evaluating to a CacheItem, or evaluating to null if there is no item in cache of the given key.