Sobes.tech
Senior

Can we use mechanisms other than versioning in optimistic locking?

sobes.tech AI

Answer from AI

Optimistic locking typically uses a version or timestamp to detect conflicts during data updates. Besides versioning, other methods include:

  • Hash sums (e.g., MD5 or SHA) of the record content to check for changes.
  • Comparing checksum or object state before updating.
  • Using unique tokens or markers that are updated upon change.

The main idea is to have a way to determine that data has not changed since the last read, to avoid overwriting others' changes.