Best way to store com.google.gson.JsonObject in couchbase

#1

I have com.google.gson.JsonObject 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?

#2

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