Debmalya Jash
Debmalya Jash

Reputation: 311

Couchbase setting value

From my java code while storing into couchbase, to ensure that it is properly saved in couchbase used following code blocks.

OperationFuture< Boolean > result = couchClient.set(<key>,<value> );
        while( !result.isDone() ) {
            try {
               Thread.sleep( 5 );
            }catch( InterruptedException e ) {
                errorLog.error( "Error occurred while setting in couchbase " + e.getMessage() );
            }
    }

Checking with other whether there is any better way to ensure that object stored properly in couchbase.

Upvotes: 0

Views: 38

Answers (1)

Matt Ingenthron
Matt Ingenthron

Reputation: 1894

The best way to handle this is what Couchbase calls Durability Requirements, which may be used on an operation like an .upsert() in the 2.x client. This is covered in the Couchbase Java documentation with a link to more info on the concept.

Upvotes: 1

Related Questions