lib/infinispan.js
function(k, v, version, opts) {
        var ctx = u.context(MEDIUM);
        logger.debugl(function() { return ['Invoke replaceWithVersion(msgId=%d,key=%s,value=%s,version=0x%s,opts=%s)',
                                           ctx.id, u.str(k), u.str(v), version.toString('hex'), JSON.stringify(opts)]; });
        var decoder = p.decodePrevOrElse(opts, p.hasPrevious, p.complete(p.hasSuccess));
        return futureKey(ctx, 0x09, k, p.encodeKeyValueVersion(k, v, version), decoder, opts);
      }
function(k, v, version, opts) {
        var ctx = u.context(MEDIUM);
        logger.debugl(function() { return ['Invoke replaceWithVersion(msgId=%d,key=%s,value=%s,version=0x%s,opts=%s)',
                                           ctx.id, u.str(k), u.str(v), version.toString('hex'), JSON.stringify(opts)]; });
        var decoder = p.decodePrevOrElse(opts, p.hasPrevious, p.complete(p.hasSuccess));
        return futureKey(ctx, 0x09, k, p.encodeKeyValueVersion(k, v, version), decoder, opts);
      }
function ( k , v , version , opts ) { var ctx = u . context ( MEDIUM ) ; logger . debugl ( function ( ) { return [ 'Invoke replaceWithVersion(msgId=%d,key=%s,value=%s,version=0x%s,opts=%s)' , ctx . id , u . str ( k ) , u . str ( v ) , version . toString ( 'hex' ) , JSON . stringify ( opts ) ] ; } ) ; var decoder = p . decodePrevOrElse ( opts , p . hasPrevious , p . complete ( p . hasSuccess ) ) ; return futureKey ( ctx , 0x09 , k , p . encodeKeyValueVersion ( k , v , version ) , decoder , opts ) ; }
Replaces the given value only if its version matches the supplied
version.

@param k {(String|Object)} Key with which the specified value is associated.
@param v {(String|Object)} Value expected to be associated with the specified key.
@param version {Buffer} binary buffer version that should match the
one in the server for the operation to succeed. Version information
can be retrieved with getWithMetadata method.
@param opts {?StoreOptions} Optional store options.
@returns {module:promise.Promise.<(Boolean|String|Object)>}
A promise that will be completed with true if the version matches
and the mapping was replaced, otherwise it returns false if not
replaced because key does not exist or version sent does not match
server-side version.
If the 'previous' option is enabled, it returns the value that was
replaced if the version matches. If the version does not match, the
current value is returned. Fianlly if the key did not exist it
returns undefined.
@memberof Client#
@since 0.3
Replaces the given value only if its version matches the supplied version .