in folsom/src/main/java/com/spotify/folsom/client/binary/SetRequest.java [96:113]
public void handle(final BinaryResponse replies, final HostAndPort server) throws IOException {
ResponsePacket reply = handleSingleReply(replies);
if (OpCode.getKind(reply.opcode) != OpCode.SET) {
throw new IOException("Unmatched response");
}
MemcacheStatus status = reply.status;
// Make it compatible with the ascii protocol
if (status == MemcacheStatus.KEY_EXISTS && opcode == OpCode.ADD) {
status = MemcacheStatus.ITEM_NOT_STORED;
} else if (status == MemcacheStatus.KEY_NOT_FOUND
&& (opcode == OpCode.APPEND || opcode == OpCode.PREPEND)) {
status = MemcacheStatus.ITEM_NOT_STORED;
}
succeed(status);
}