.NET Client Documentation
5.1.1
Search Results for

    Show / Hide Table of Contents

    PutAsync Method

    PutAsync(TKey, TValue, TimeSpan, TimeSpan)

    Sets (adds or updates) an entry, and returns the previous value, if any.

    Declaration
    Task<TValue> PutAsync(TKey key, TValue value, TimeSpan timeToLive, TimeSpan maxIdle)
    Parameters
    TKey key

    The key.

    TValue value

    The value.

    TimeSpan timeToLive

    A time to live (0ms to live forever; -1ms to use the server-configured value).

    TimeSpan maxIdle

    A max-idle time (0ms to never become idle).

    Returns
    Task<TValue>

    The previous value for the specified key, if any; otherwise default(TValue).

    Remarks

    The value is automatically expired, evicted and removed after the timeToLive has elapsed. If timeToLive is 0ms, the value is retained indefinitely. If it is -1ms, it lives for the duration of the server-configured time-to-live.

    The value is considered idle after the maxIdle has elapsed. If it is 0ms, the value never becomes idle.

    In This Article
    Back to top Copyright © 2010-2022 Hazelcast, Inc. All rights reserved.
    Generated by DocFX.