Best way to store in couchbase


I have to store in couchbase. Directly I can not store this type of object. I am using following code.

 public RawJsonDocument put(final String key, final JsonObject googleJsonObject) {
		try {
			  RawJsonDocument subscriberDocument = RawJsonDocument.create(key, googleJsonObject.toString());
			return bucket.upsert(subscriberDocument);
		} catch (Throwable th) {
			return null;

I am not happy with the above code. It is quite slow. How to make it better?


What are your expectations? The code looks fine. You could maybe benchmark the googleJsonObject.toString() and bucket.upsert separately?