Client-server synchronization pattern / algorithm?

后端 未结 7 2283
醉酒成梦
醉酒成梦 2020-11-27 08:41

I have a feeling that there must be client-server synchronization patterns out there. But i totally failed to google up one.

Situation is quite simple - server is th

7条回答
  •  生来不讨喜
    2020-11-27 09:16

    The question is not crystal clear, but I'd look into optimistic locking if I were you. It can be implemented with a sequence number that the server returns for each record. When a client tries to save the record back, it will include the sequence number it received from the server. If the sequence number matches what's in the database at the time when the update is received, the update is allowed and the sequence number is incremented. If the sequence numbers don't match, the update is disallowed.

提交回复
热议问题