PutTransientAsync Method
PutTransientAsync(TKey, TValue, TimeSpan)
Sets (adds or updates) an entry without calling the MapStore
on the server side, if defined.
Declaration
Task PutTransientAsync(TKey key, TValue value, TimeSpan timeToLive)
Parameters
TKey | key | A key. |
TValue | value | A value. |
TimeSpan | timeToLive | A time to live (0ms to live forever; -1ms to use the server-configured value). |
Returns
Task |
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 becomes idle after the server-configured idle time.
If the dictionary has a MapStore
attached, the entry is added to the store but not persisted.
Flushing the store is required to make sure that the entry is actually persisted.
Time resolution for is seconds. The given value is rounded to the next closest second value.
PutTransientAsync(TKey, TValue, TimeSpan, TimeSpan)
Sets (adds or updates) an entry without calling the MapStore
on the server side, if defined.
Declaration
Task PutTransientAsync(TKey key, TValue value, TimeSpan timeToLive, TimeSpan maxIdle)
Parameters
TKey | key | A key. |
TValue | value | A 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 | The value for the key. This will be either the existing value for the key if the entry already exists, or the new value if the no entry with the key already existed. |
Remarks
The value is automatically expired, evicted and removed after the
timeToLive
has elapsed. If timeToLive
is TimeToLive.Infinite
i.e. 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.
If the dictionary has a MapStore
attached, the entry is added to the store but not persisted.
Flushing the store is required to make sure that the entry is actually persisted.
The value is automatically expired, evicted and removed after the timeToLive
has elapsed.
Time resolution for is seconds. The given value is rounded to the next closest second value.