Search:

Search all manuals
Search this manual
Manual
Couchbase Client Library: Java 1.1
Community Wiki and Resources
Download Client Library
JavaDoc
Couchbase Developer Guide 2.0
Couchbase Server Manual 2.0
Java Client Library
SDK Forum
Wiki: Java Client Library
Additional Resources
Community Wiki
Community Forums
Couchbase SDKs
Parent Section
7 Retrieve Operations
Chapter Sections
Chapters

7.6. Get and Lock

API Callclient.asyncGetLock(key [, getl-expiry ], transcoder)
Asynchronousyes
Description Get the value for a key, lock the key from changes
ReturnsFuture<CASValue<T>> ( Asynchronous request value, as CASValue as Transcoded object )
Arguments 
String key Document ID used to identify the value
int getl-expiry Expiry time for lock
 Default15 
 Maximum30 
Transcoder<T> transcoder Transcoder class to be used to serialize value
API Callclient.asyncGetLock(key [, getl-expiry ])
Asynchronousyes
Description Get the value for a key, lock the key from changes
ReturnsFuture<CASValue<Object>> ( Asynchronous request value, as CASValue, as Object )
Arguments 
String key Document ID used to identify the value
int getl-expiry Expiry time for lock
 Default15 
 Maximum30 
API Callclient.getAndLock(key [, getl-expiry ], transcoder)
Asynchronousno
Description Get the value for a key, lock the key from changes
ReturnsCASValue<T> ( CASValue as Transcoded object )
Arguments 
String key Document ID used to identify the value
int getl-expiry Expiry time for lock
 Default15 
 Maximum30 
Transcoder<T> transcoder Transcoder class to be used to serialize value
Exceptions 
OperationTimeoutException Exception timeout occured while waiting for value.
RuntimeException Exception object specifying interruption while waiting for value.

The simplest form of the method is without the transcoder as below.

API Callclient.getAndLock(key [, getl-expiry ])
Asynchronousyes
Description Get the value for a key, lock the key from changes
ReturnsCASValue<Object> ( CASValue as Object )
Arguments 
String key Document ID used to identify the value
int getl-expiry Expiry time for lock
 Default15 
 Maximum30 
Exceptions 
OperationTimeoutException Exception timeout occured while waiting for value.
RuntimeException Exception object specifying interruption while waiting for value.
CASValue<Object> casv = client.getAndLock("keyA", 3);

Will lock keyA for 3 seconds or until an Unlock is issued.