Couchbase
  • Why NoSQL?
  • Couchbase Server
  • Download
  • Resources
  • Careers
Home | Forums | SDKs | SDKs

New CAS id after update (Java SDK)

2 replies [Last post]
  • Login or register to post comments
Mon, 11/12/2012 - 15:37
rahulaga
Offline
Joined: 09/06/2012
Groups: None

I using the latest java SDK 1.1dp4

I am attempting to use the casId as an optimistic locking mechanism by providing it to the client. Flow:
1. gets -> return object + casId to client
2. cas -> client provides the casId and new value

The problem I have is with the cas method returning CASResponse which is an enum. It does not return the *new* casId after the update. I would have to issue a new "gets" which may not return the correct casId (other threads may have gets/cas in the meantime).

Maybe this is a new feature request or I am missing something?

Thanks

Top
  • Login or register to post comments
Wed, 11/14/2012 - 10:36
mikew
Offline
Joined: 03/14/2011
Groups:

Try using the asyncCas() function which returns an OperationFuture. You should be able to call getCas() from the returned value.

Top
  • Login or register to post comments
Wed, 11/14/2012 - 11:36
rahulaga
Offline
Joined: 09/06/2012
Groups: None

Brilliant, thanks Mike! Looks like I need to undo own implementation and use this :)

Top
  • Login or register to post comments
  • Login or register to post comments
  • Login
  • Register

Company

  • About Us
  • Leadership
  • Customers
  • Partners
  • Contact Us

Product

  • Couchbase Server
  • Couchbase SDKs
  • Use Cases
  • Documentation
  • Forums

Open Source

  • Couchbase Project
  • Couchbase vs. CouchDB

Commercial

  • Subscriptions & Support
  • Training & Services

News

  • Blog
  • Newsletter
  • Press Releases
  • Buzz

Follow Us

    
  • Customer Login
  • Terms of Service
  • Privacy Policy
  • Trademark Policy
  • Site Map

© 2013 COUCHBASE All rights reserved.

Sign in to Couchbase Community

close
  • Create new account
  • Request new password
You are logging into the Forums, Wiki and Issue Tracker