return visitor.visitPutKeyValueCommand(ctx, this);
}
public Object perform(InvocationContext ctx) throws Throwable {
Object o;
MVCCEntry e = (MVCCEntry) ctx.lookupEntry(key);
Object entryValue = e.getValue();
if (entryValue != null && putIfAbsent && !e.isRemoved()) {
successful = false;
return entryValue;
} else {
notifier.notifyCacheEntryModified(key, entryValue, true, ctx);
if (value instanceof Delta) {
// magic
Delta dv = (Delta) value;
DeltaAware toMergeWith = null;
if (entryValue instanceof DeltaAware) toMergeWith = (DeltaAware) entryValue;
e.setValue(dv.merge(toMergeWith));
o = entryValue;
e.setLifespan(lifespanMillis);
e.setMaxIdle(maxIdleTimeMillis);
} else {
o = e.setValue(value);
if (e.isRemoved()) {
e.setRemoved(false);
e.setValid(true);
o = null;
}
e.setLifespan(lifespanMillis);
e.setMaxIdle(maxIdleTimeMillis);
}
notifier.notifyCacheEntryModified(key, e.getValue(), false, ctx);
}
return o;
}