You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This operation is used to implement synchronization primitives like semaphores and mutexes, as well as more sophisticated lock-free and wait-free algorithms.
// When you want to use CAS for a few attributes only:r.table("posts").get(1).update({title: r.compareAndSwap("Lorem ipsum OBSOLETUS","Lorem ipsum NOVUS"),content: "Dolor sit amet"})// When you want to use CAS for many attributes:r.table("posts").get(1).update(r.compareAndSwap({title: "Lorem ipsum OBSOLETUS",content: "Dolor sit amet OBSOLETUS"},{title: "Lorem ipsum NOVUS",content: "Dolor sit amet NOVUS"}))
This could be internally converted to something like
r.table("posts").get(1).update({title: r.branch(r.row('title').eq("Lorem ipsum OBSOLETUS"),"Lorem ipsum NOVUS",r.error(r.row('title'))// return an error indicating what was the unexpected value)})
The text was updated successfully, but these errors were encountered:
From Wikipedia article on CAS:
CAS will be useful in #5144 for instance.
Proposed syntax:
This could be internally converted to something like
The text was updated successfully, but these errors were encountered: