Class AchievementRevisionClock
Stamps every achievement write with a strictly increasing revision, so the store's upsert-if-better comparison always recognizes the newest write as the winner.
Inherited Members
Namespace: Serenity.Achievements.Domain.Services
Assembly: Serenity.Achievements.Domain.dll
Syntax
public static class AchievementRevisionClock
Remarks
Wall-clock ticks alone are not enough: two writes inside the same tick, or a clock that steps backwards, would both produce a revision the store refuses. Taking the larger of "one past the last known revision" and "now" keeps the sequence monotonic under either condition while still reading as a timestamp in the common case.
Methods
Next(long, long)
Returns the next revision to stamp a write with.
Declaration
public static long Next(long lastKnownRevision, long utcNowTicks)
Parameters
| Type | Name | Description |
|---|---|---|
| long | lastKnownRevision | The revision the row currently carries, or zero when it is new. |
| long | utcNowTicks | The current UTC time in ticks. |
Returns
| Type | Description |
|---|---|
| long | A revision strictly greater than |