private void CreateDeleteCommand(Opcode type, bool noreply) { string key = MemcachedEncoding.BinaryConverter.GetString(_rawData, 0, _requestHeader.KeyLength); DeleteCommand cmd = new DeleteCommand(type); cmd.Key = key; cmd.NoReply = noreply; _command = cmd; }
public static byte[] BuildDeleteResponse(DeleteCommand command) { BinaryResponseStatus status = BinaryResponseStatus.no_error; if (command.OperationResult.ReturnResult != Result.SUCCESS) status = BinaryResponseStatus.key_not_found; else { if (command.NoReply == true) return null; } return BuildResposne(command.Opcode, status, command.Opaque, 0, null, null, null); }
private void CreateDeleteCommand(string arguments) { if (String.IsNullOrEmpty(arguments)) { CreateInvalidCommand(); return; } string[] argumentsArray = arguments.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); if (argumentsArray.Length > 2 || argumentsArray.Length < 1) { CreateInvalidCommand(); return; } DeleteCommand command = new DeleteCommand(Opcode.Delete); switch (argumentsArray.Length) { case 1: command.Key = argumentsArray[0]; break; case 2: if (argumentsArray[1] != "noreply") command.ErrorMessage = "CLIENT_ERROR bad command line format. Usage: delete <key> [noreply]"; else { command.Key = argumentsArray[0]; command.NoReply = true; } break; default: command.ErrorMessage = "CLIENT_ERROR bad command line format. Usage: delete <key> [noreply]"; break; } _command = command; this.State = ParserState.ReadyToDispatch; }