async operations

Sometimes, applications perform operations on a database that doesn't need to wait until it is completed for further processing. Such operations will optimize resources in terms of CPU and disk I/O. Instead of holding the current thread and waiting for the response of that database queries, it proceeds further. Such asynchronous operations are allowed to use using Couchbase SDK. Let me show you a sample code and explain more about this:

AsyncBucket aBucket = theBucket.async(); aBucket.get("2007").map(new Func1<JsonDocument, String>() { public String call(JsonDocument jsonDocument) { jsonDocument.content().put("name"," Mr " + jsonDocument.content().getString("name")); return jsonDocument.content().getString("name"); } }).subscribe(new ...

Get Learning Couchbase now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.