Method TryRefreshSessionAsync
TryRefreshSessionAsync(TSessionToken, SessionRecord, int)
Updates the session associated with the specified session token with the provided refreshed values if the stored session generation still matches
expectedGeneration. Returns true if the session was updated, or false if the session no longer
exists or its generation has changed since it was loaded (i.e. it was refreshed or invalidated concurrently).
Declaration
Task<bool> TryRefreshSessionAsync(TSessionToken sessionToken, SessionRecord refreshedSession, int expectedGeneration)
Parameters
| Type | Name | Description |
|---|---|---|
| TSessionToken | sessionToken | The token identifying the session to refresh. |
| SessionRecord | refreshedSession | The values to store for the refreshed session. |
| int | expectedGeneration | The generation the stored session must currently have for the update to be applied. |
Returns
| Type | Description |
|---|---|
| Task<bool> |
Remarks
The generation check and the update must be performed atomically, i.e. as a single conditional update statement or an equivalent compare-and-swap operation, so that two concurrent refreshes cannot both succeed.