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 |
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.