HTTP API Toolkit HTTP API Toolkit
HTTP API Toolkit HTTP API Toolkit
DocFX + Singulink = ♥

Search Results for

    Method TryAddAsync

    TryAddAsync<T>(IShortLivedStore, string, string, T, JsonTypeInfo<T>, TimeSpan, CancellationToken)

    Adds a state, as JSON, under an ID of the app's choosing unless the key already has a value.

    Declaration
    public static ValueTask<bool> TryAddAsync<T>(this IShortLivedStore store, string keyPrefix, string id, T state, JsonTypeInfo<T> typeInfo, TimeSpan lifetime, CancellationToken cancellationToken = default) where T : class
    Parameters
    Type Name Description
    IShortLivedStore store

    The store.

    string keyPrefix

    The start of the key, which keeps the states of one flow apart from all others.

    string id

    The ID of the state within the prefix.

    T state

    The state.

    JsonTypeInfo<T> typeInfo

    The JSON type information of the state.

    TimeSpan lifetime

    How long the state is kept. Must be positive.

    CancellationToken cancellationToken

    A token to cancel the operation.

    Returns
    Type Description
    ValueTask<bool>

    true if the state was added, or false if the key already has a value.

    Type Parameters
    Name Description
    T
    © Singulink. All rights reserved.