cmdType == Command.APPEND ||
cmdType == Command.PREPEND) {
// if we don't have all the parts, it's malformed
if (numParts < 5) {
throw new MalformedCommandException("invalid command length");
}
// Fill in all the elements of the command
int size = Integer.parseInt(parts[4]);
int expire = Integer.parseInt(parts[3]);
int flags = Integer.parseInt(parts[2]);
cmd.element = new MCElement(parts[1], flags, expire != 0 && expire < MCElement.THIRTY_DAYS ? MCElement.Now() + expire : expire, size);
// look for cas and "noreply" elements
if (numParts > 5) {
int noreply = cmdType == Command.CAS ? 6 : 5;
if (cmdType == Command.CAS) {
cmd.cas_key = Long.valueOf(parts[5]);
}
if (numParts == noreply + 1 && parts[noreply].equalsIgnoreCase(NOREPLY))
cmd.noreply = true;
}
// Now indicate that we need more for this command by changing the session status's state.
// This instructs the frame decoder to start collecting data for us.
status.needMore(size, cmd);
} else if (cmdType == Command.GET ||
cmdType == Command.GETS ||
cmdType == Command.STATS ||
cmdType == Command.QUIT ||
cmdType == Command.VERSION) {
// Get all the keys
cmd.keys.addAll(Arrays.asList(parts).subList(1, numParts));
// Pass it on.
Channels.fireMessageReceived(channelHandlerContext, cmd, channel.getRemoteAddress());
} else if (cmdType == Command.INCR ||
cmdType == Command.DECR) {
// Malformed
if (numParts < 2 || numParts > 3)
throw new MalformedCommandException("invalid increment command");
cmd.keys.add(parts[1]);
cmd.incrAmount = Integer.valueOf(parts[2]);
if (numParts == 3 && parts[2].equalsIgnoreCase(NOREPLY)) {