The asynchronous asyncGet() methods allow
to retrieve a given value for a key without waiting actively for a
response.
| API Call | client.asyncGet(key) | ||
| Asynchronous | yes | ||
| Description | Get one or more key values | ||
| Returns | Future<Object> (
Asynchronous request value, as Object
) | ||
| Arguments | |||
String key | Document ID used to identify the value | ||
| Exceptions | |||
TimeoutException | Value could not be retrieved | ||
The first form of the asyncGet() method
obtains a value for a given key returning a Future object so that
the value can be later retrieved. For example, to get a key with a
stored String value:
Future<Object> userobj = membase.asyncGet("samplekey"); String username; try { username = userobj.get(5, TimeUnit.SECONDS); } catch(TimeoutException e) { userobj.cancel(false); }
| API Call | client.asyncGet(key, transcoder) | ||
| Asynchronous | yes | ||
| Description | Get one or more key values | ||
| Returns | Future<T> (
Asynchronous request value, as Transcoded Object
) | ||
| Arguments | |||
String key | Document ID used to identify the value | ||
Transcoder<T> transcoder | Transcoder class to be used to serialize value | ||
The second form is identical to the first, but includes the ability to use a custom transcoder on the stored value.