The synchronous get() methods allow for
direct access to a given key/value pair.
| API Call | client.get(key) | ||
| Asynchronous | no | ||
| Description | Get one or more key values | ||
| Returns | Object (
Binary object
) | ||
| Arguments | |||
String key | Document ID used to identify the value | ||
The get() method obtains an object stored
in Membase using the default transcoder for serialization of the
object.
For example:
Object myObject = membase.get("someKey");Transcoding of the object assumes the default transcoder was used when the value was stored. The returned object can be of any type.
If the request key does not exist in the database then the returned value is null.
| API Call | client.get(key, transcoder) | ||
| Asynchronous | no | ||
| Description | Get one or more key values | ||
| Returns | T (
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 of the get() retrieves a
value from Membase using a custom transcoder.
For example to obtain an integer value using the IntegerTranscoder:
Transcoder<Integer> tc = new IntegerTranscoder(); Integer ic = membase.get("someKey", tc);