No — the gateway uses a simple Set call without CAS to update the app bucket.
What you're suggesting, I think, is for the gateway to record the CAS value whenever it saves a document to the app bucket, and then use a Set-with-CAS the next time it updates the document; that way if the CAS value has changed the Set will fail, and the gateway can read the current value from the app bucket.
It's been a while since I worked on this code, but IIRC there are two problems:
1. Couchbase Server's Set call doesn't return the new CAS value. So to get this value we'd have to issue an immediate Get after the Set, which could be bad for performance (and is subject to possible race conditions.)
2. It's unclear what to do if there is a conflict. CAS codes carry less information than the revision histories that the Gateway and Couchbase Lite use. The result would be a conflict, but I'm not sure if it would be possible to add the new version from the app bucket to the revision tree in a meaningful way. (Hm, it might be. This needs more thought…)
Do you have any more ideas about how you think this should work? (I will freely admit that I'm not an expert on CAS.)
—Jens