PDF Title | Developing with Couchbase Server |
---|---|
Pages | 87 Pages |
PDF Size | 3.7 MB |
Language | English |
Sub-Category | |
Source | O’Reilly |
Developing with Couchbase Server – Download
Optimistic locking in Couchbase tries to prevent the updating of a document without the right CAS value. It’s optimistic because it doesn’t protect against the fact that a client can still update the document by using a straightforward set() function to update the document value. Pessimistic locking within Couchbase relies on implementing an ex‐ plicit locking based mechanism that is ultimately unlocked by updating the value using a CAS compatible function, by explicitly unlocking (using the CAS value), or allowing the lock to optionally time out. With pessimistic locking, it’s impossible to update without using a CAS compatible update function. Usually locking is used as a more explicit method of enforcing the concurrency elements. While a lock is in place, other clients can obtain the value, but they cannot update it without using a CAS compatible update and having the right CAS value.