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

Overhead for get with cas token

2 replies [Last post]
  • Login or register to post comments
Thu, 11/15/2012 - 02:56
mirsilstan
Offline
Joined: 11/15/2012
Groups: None

Hello all,

I was wondering if there is a penalty incurred by always getting a value from Couchbase together with the CAS token.

I am thinking of always getting records with their respective CAS tokens, so in case I need to make a CAS operation, I already have the necessary value.

The alternative would be get the object by default without the CAS token and in case I need to make a CAS operation, I would get the object a second time, this time with the CAS token and then I would make the CAS.

Thanks.

Top
  • Login or register to post comments
Fri, 11/16/2012 - 11:56
mikew
Offline
Joined: 03/14/2011
Groups:

There is no hidden overhead from getting a cas token. The cas is actually part of the memcached packet header and is returned by every operation no matter what you are doing.

If you do the following

set key1
gets key1

Then you will just incur the overhead of doing an extra operation. If the client library supports returning the cas for all operations then you should be able to retrieve the cas directly from the set meaning there is no overhead.

Which SDK are you using?

Top
  • Login or register to post comments
Mon, 11/19/2012 - 01:17
mirsilstan
Offline
Joined: 11/15/2012
Groups: None

I am using the PHP Client Library, I found out after some trials & errors the way to get a value together with its CAS token using the PHP API:

$casToken = 0;
$value = $cb->get($key, null, &$casToken);

Do you know if this the recommended way to do it?

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