//PROTOBUF public override void ExecuteCommand(ClientManager clientManager, Alachisoft.NCache.Common.Protobuf.Command command) { CommandInfo cmdInfo; //TODO byte[] data = null; try { cmdInfo = ParseCommand(command, clientManager); } catch (Exception exc) { if (!base.immatureId.Equals("-2")) { _serializedResponsePackets.Add(Alachisoft.NCache.Common.Util.ResponseHelper.SerializeExceptionResponse(exc, command.requestID)); } return; } try { NCache nCache = clientManager.CmdExecuter as NCache; long count = nCache.Cache.Count; Alachisoft.NCache.Common.Protobuf.CountResponse countResponse = new Alachisoft.NCache.Common.Protobuf.CountResponse(); Alachisoft.NCache.Common.Protobuf.Response response = new Alachisoft.NCache.Common.Protobuf.Response(); countResponse.count = count; response.count = countResponse; response.requestId = Convert.ToInt64(cmdInfo.RequestId); response.responseType = Alachisoft.NCache.Common.Protobuf.Response.Type.COUNT; _serializedResponsePackets.Add(Alachisoft.NCache.Common.Util.ResponseHelper.SerializeResponse(response)); } catch (Exception exc) { _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; //TODO byte[] data = null; try { cmdInfo = ParseCommand(command, clientManager); } catch (Exception exc) { if (!base.immatureId.Equals("-2")) _serializedResponsePackets.Add(Alachisoft.NCache.Common.Util.ResponseHelper.SerializeExceptionResponse(exc, command.requestID)); return; } try { NCache nCache = clientManager.CmdExecuter as NCache; long count = nCache.Cache.Count; Alachisoft.NCache.Common.Protobuf.CountResponse countResponse = new Alachisoft.NCache.Common.Protobuf.CountResponse(); Alachisoft.NCache.Common.Protobuf.Response response = new Alachisoft.NCache.Common.Protobuf.Response(); countResponse.count = count; response.count = countResponse; response.requestId = Convert.ToInt64(cmdInfo.RequestId); response.responseType = Alachisoft.NCache.Common.Protobuf.Response.Type.COUNT; _serializedResponsePackets.Add(Alachisoft.NCache.Common.Util.ResponseHelper.SerializeResponse(response)); } catch (Exception exc) { _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; int overload; string exception = null; Stopwatch stopWatch = new Stopwatch(); stopWatch.Start(); long result = 0; byte[] data = null; try { overload = command.MethodOverload; cmdInfo = ParseCommand(command, clientManager); } catch (Exception exc) { if (!base.immatureId.Equals("-2")) { _serializedResponsePackets.Add(Alachisoft.NCache.Common.Util.ResponseHelper.SerializeExceptionResponse(exc, command.requestID, command.commandID)); } return; } try { NCache nCache = clientManager.CmdExecuter as NCache; long count = nCache.Cache.Count; stopWatch.Stop(); result = count; Alachisoft.NCache.Common.Protobuf.CountResponse countResponse = new Alachisoft.NCache.Common.Protobuf.CountResponse(); Alachisoft.NCache.Common.Protobuf.Response response = new Alachisoft.NCache.Common.Protobuf.Response(); countResponse.count = count; response.count = countResponse; response.requestId = Convert.ToInt64(cmdInfo.RequestId); response.commandID = command.commandID; response.responseType = Alachisoft.NCache.Common.Protobuf.Response.Type.COUNT; _serializedResponsePackets.Add(Alachisoft.NCache.Common.Util.ResponseHelper.SerializeResponse(response)); } catch (Exception exc) { exception = exc.ToString(); _serializedResponsePackets.Add(Alachisoft.NCache.Common.Util.ResponseHelper.SerializeExceptionResponse(exc, command.requestID, command.commandID)); } 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.Count.ToLower()); log.GenerateCacheCountAPILogItem(1, exception, executionTime, clientManager.ClientID.ToLower(), clientManager.ClientSocketId.ToString(), result); } } catch { } } }