//PROTOBUF public override void ExecuteCommand(ClientManager clientManager, Alachisoft.NCache.Common.Protobuf.Command command) { CommandInfo cmdInfo; try { cmdInfo = ParseCommand(command, clientManager); } catch (Exception exc) { if (!base.immatureId.Equals("-2")) { //PROTOBUF:RESPONSE _serializedResponsePackets.Add(Alachisoft.NCache.Common.Util.ResponseHelper.SerializeExceptionResponse(exc, command.requestID)); } return; } NCache nCache = clientManager.CmdExecuter as NCache; try { CallbackEntry cbEntry = null; OperationContext operationContext = new OperationContext(OperationContextFieldName.OperationType, OperationContextOperationType.CacheOperation); nCache.Cache.Clear(cmdInfo.FlagMap, cbEntry, operationContext); Alachisoft.NCache.Common.Protobuf.Response response = new Alachisoft.NCache.Common.Protobuf.Response(); Alachisoft.NCache.Common.Protobuf.ClearResponse clearResponse = new Alachisoft.NCache.Common.Protobuf.ClearResponse(); response.requestId = Convert.ToInt64(cmdInfo.RequestId); response.responseType = Alachisoft.NCache.Common.Protobuf.Response.Type.CLEAR; response.clearResponse = clearResponse; _serializedResponsePackets.Add(Alachisoft.NCache.Common.Util.ResponseHelper.SerializeResponse(response)); } catch (Exception exc) { //PROTOBUF:RESPONSE _serializedResponsePackets.Add(Alachisoft.NCache.Common.Util.ResponseHelper.SerializeExceptionResponse(exc, command.requestID)); } }
//PROTOBUF public override void ExecuteCommand(ClientManager clientManager, Alachisoft.NCache.Common.Protobuf.Command command) { CommandInfo cmdInfo; try { cmdInfo = ParseCommand(command, clientManager); } catch (Exception exc) { if (!base.immatureId.Equals("-2")) { //PROTOBUF:RESPONSE _serializedResponsePackets.Add(Alachisoft.NCache.Common.Util.ResponseHelper.SerializeExceptionResponse(exc, command.requestID)); } return; } NCache nCache = clientManager.CmdExecuter as NCache; try { CallbackEntry cbEntry = null; OperationContext operationContext = new OperationContext(OperationContextFieldName.OperationType, OperationContextOperationType.CacheOperation); nCache.Cache.Clear(cmdInfo.FlagMap, cbEntry, operationContext); Alachisoft.NCache.Common.Protobuf.Response response = new Alachisoft.NCache.Common.Protobuf.Response(); Alachisoft.NCache.Common.Protobuf.ClearResponse clearResponse = new Alachisoft.NCache.Common.Protobuf.ClearResponse(); response.requestId = Convert.ToInt64(cmdInfo.RequestId); response.responseType = Alachisoft.NCache.Common.Protobuf.Response.Type.CLEAR; response.clearResponse = clearResponse; _serializedResponsePackets.Add(Alachisoft.NCache.Common.Util.ResponseHelper.SerializeResponse(response)); } catch (Exception exc) { //PROTOBUF:RESPONSE _serializedResponsePackets.Add(Alachisoft.NCache.Common.Util.ResponseHelper.SerializeExceptionResponse(exc, command.requestID)); } }
//PROTOBUF public override void ExecuteCommand(ClientManager clientManager, Alachisoft.NCache.Common.Protobuf.Command command) { CommandInfo cmdInfo = default(CommandInfo); int overload; string exception = null; Stopwatch stopWatch = new Stopwatch(); stopWatch.Start(); try { try { overload = command.MethodOverload; cmdInfo = ParseCommand(command, clientManager); } catch (Exception exc) { if (!base.immatureId.Equals("-2")) { //PROTOBUF:RESPONSE _serializedResponsePackets.Add(Alachisoft.NCache.Common.Util.ResponseHelper.SerializeExceptionResponseWithType(exc, command.requestID, command.commandID, clientManager.ClientVersion)); } return; } NCache nCache = clientManager.CmdExecuter as NCache; if (!cmdInfo.DoAsync) { try { Notifications notification = null; if (cmdInfo.DsClearedId != -1) { notification = new Notifications(clientManager.ClientID, -1, -1, -1, -1, cmdInfo.DsClearedId , Runtime.Events.EventDataFilter.None, Runtime.Events.EventDataFilter.None); //DataFilter not required } OperationContext operationContext = new OperationContext(OperationContextFieldName.OperationType, OperationContextOperationType.CacheOperation); operationContext.Add(OperationContextFieldName.RaiseCQNotification, true); operationContext.Add(OperationContextFieldName.WriteThruProviderName, cmdInfo.providerName); nCache.Cache.Clear(cmdInfo.FlagMap, notification, operationContext); stopWatch.Stop(); Alachisoft.NCache.Common.Protobuf.ClearResponse clearResponse = new Alachisoft.NCache.Common.Protobuf.ClearResponse(); if (clientManager.ClientVersion >= 5000) { ResponseHelper.SetResponse(clearResponse, command.requestID, command.commandID); _serializedResponsePackets.Add(ResponseHelper.SerializeResponse(clearResponse, Common.Protobuf.Response.Type.CLEAR)); } else { Alachisoft.NCache.Common.Protobuf.Response response = new Alachisoft.NCache.Common.Protobuf.Response(); response.clearResponse = clearResponse; ResponseHelper.SetResponse(response, command.requestID, command.commandID, Common.Protobuf.Response.Type.CLEAR); _serializedResponsePackets.Add(Alachisoft.NCache.Common.Util.ResponseHelper.SerializeResponse(response)); } } catch (Exception exc) { //PROTOBUF:RESPONSE exception = exc.ToString(); _serializedResponsePackets.Add(Alachisoft.NCache.Common.Util.ResponseHelper.SerializeExceptionResponseWithType(exc, command.requestID, command.commandID, clientManager.ClientVersion)); } finally { TimeSpan executionTime = stopWatch.Elapsed; try { if (Alachisoft.NCache.Management.APILogging.APILogManager.APILogManger != null && Alachisoft.NCache.Management.APILogging.APILogManager.EnableLogging) { APILogItemBuilder log = new APILogItemBuilder(MethodsName.Clear.ToLower()); log.GenerateClearAPILogItem(cmdInfo.FlagMap, overload, exception, executionTime, clientManager.ClientID.ToLower(), clientManager.ClientSocketId.ToString()); } } catch { } } } else { OperationContext operationContext = new OperationContext(OperationContextFieldName.OperationType, OperationContextOperationType.CacheOperation); operationContext.Add(OperationContextFieldName.RaiseCQNotification, true); operationContext.Add(OperationContextFieldName.WriteThruProviderName, cmdInfo.providerName); nCache.Cache.ClearAsync(cmdInfo.FlagMap, new Notifications(clientManager.ClientID, Convert.ToInt32(cmdInfo.RequestId), -1, -1, 0, cmdInfo.DsClearedId, EventDataFilter.None, EventDataFilter.None) , operationContext); stopWatch.Stop(); TimeSpan executionTime = stopWatch.Elapsed; try { if (Alachisoft.NCache.Management.APILogging.APILogManager.APILogManger != null && Alachisoft.NCache.Management.APILogging.APILogManager.EnableLogging) { APILogItemBuilder log = new APILogItemBuilder(MethodsName.ClearAsync.ToLower()); log.GenerateClearAsyncAPILogItem(cmdInfo.FlagMap, cmdInfo.DsClearedId, overload, exception, executionTime, clientManager.ClientID.ToLower(), clientManager.ClientSocketId.ToString()); } } catch { } } } finally { cmdInfo.FlagMap?.MarkFree(NCModulesConstants.SocketServer); } }