code: public static Value putIfMatch( Key key, Value val, Value old ) {
      if( old != null ) // Have an old value?
        key = old._key; // Use prior key
      if( val != null ) {
        assert val._key.equals(key);
        if( val._key != key ) val._key = key; // Attempt to uniquify keys
      }
  
      // Insert into the K/V store
      Value res = STORE.putIfMatchUnlocked(key,val,old);
      if( res != old ) return res; // Return the failure cause
      // Persistence-tickle.
      // If the K/V mapping is going away, remove the old guy.
      // If the K/V mapping is changing, let the store cleaner just overwrite.
      // If the K/V mapping is new, let the store cleaner just create
      if( old != null && val == null ) old.removePersist(); // Remove the old guy
      if( val != null ) {
        Cleaner.dirty_store(); // Start storing the new guy
        if( old==null ) Scope.track_internal(key); // New Key - start tracking
      }
      return old; // Return success
    }
docs: replication.