• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Alachisoft类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Alachisoft的典型用法代码示例。如果您正苦于以下问题:C# Alachisoft类的具体用法?C# Alachisoft怎么用?C# Alachisoft使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Alachisoft类属于命名空间,在下文中一共展示了Alachisoft类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: ExecuteCommand

        public override void ExecuteCommand(ClientManager clientManager, Alachisoft.NCache.Common.Protobuf.Command command)
        {
            ///Command:
            /// GETLOGGINGINFO "requestId"
            ///
            string requestId = string.Empty;

            Alachisoft.NCache.Common.Protobuf.GetLoggingInfoCommand getLoggingInfoCommand = command.getLoggingInfoCommand;
            requestId = getLoggingInfoCommand.requestId.ToString();

            bool errorEnabled = ConnectionManager.GetClientLoggingInfo(LoggingInfo.LoggingType.Error) == LoggingInfo.LogsStatus.Enable;
            bool detailedEnabled = ConnectionManager.GetClientLoggingInfo(LoggingInfo.LoggingType.Detailed) == LoggingInfo.LogsStatus.Enable;

            if (!errorEnabled)
                detailedEnabled = false;

            try
            {
                Alachisoft.NCache.Common.Protobuf.Response response = new Alachisoft.NCache.Common.Protobuf.Response();
                Alachisoft.NCache.Common.Protobuf.GetLoggingInfoResponse loggingInfoResponse = new Alachisoft.NCache.Common.Protobuf.GetLoggingInfoResponse();
                response.requestId = command.requestID;
                loggingInfoResponse.errorsEnabled = errorEnabled;
                loggingInfoResponse.detailedErrorsEnabled = detailedEnabled;

                response.getLoggingInfoResponse = loggingInfoResponse;
                response.responseType = Alachisoft.NCache.Common.Protobuf.Response.Type.GET_LOGGING_INFO;

                _serializedResponsePackets.Add(Alachisoft.NCache.Common.Util.ResponseHelper.SerializeResponse(response));
            }
            catch (Exception exc)
            {
                _serializedResponsePackets.Add(Alachisoft.NCache.Common.Util.ResponseHelper.SerializeExceptionResponse(exc, command.requestID));
            }
        }
开发者ID:javithalion,项目名称:NCache,代码行数:34,代码来源:GetLogginInfoCommand.cs


示例2: ExecuteCommandOnCacehServer

        protected object ExecuteCommandOnCacehServer(Alachisoft.NCache.Common.Protobuf.ManagementCommand command)
        {
            ManagementResponse response = null;
            if (_requestManager != null)
            {
                try
                {
                    response = _requestManager.SendRequest(command) as ManagementResponse;
                }
                catch (System.Exception e)
                {
                    throw new ManagementException(e.Message,e);
                }

                if (response != null && response.exception != null)
                {
                    throw new ManagementException(response.exception.message);
                }
            }

            if (response != null)
                return response.ReturnValue;

            return null;
        }
开发者ID:javithalion,项目名称:NCache,代码行数:25,代码来源:RemoteCacheServer.cs


示例3: ExecuteCommand

        public override void ExecuteCommand(ClientManager clientManager, Alachisoft.NCache.Common.Protobuf.Command command)
        {
            CommandInfo cmdInfo;

            try
            {
                cmdInfo = ParseCommand(command, clientManager);
                if (ServerMonitor.MonitorActivity) ServerMonitor.LogClientActivity("RemCmd.Exec", "cmd parsed");

            }
            catch (Exception exc)
            {
                _removeResult = OperationResult.Failure;
                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;

                CompressedValueEntry flagValueEntry = null;

                OperationContext operationContext = new OperationContext(OperationContextFieldName.OperationType, OperationContextOperationType.CacheOperation);
                flagValueEntry = nCache.Cache.Remove(cmdInfo.Key, cmdInfo.FlagMap, cbEntry, cmdInfo.LockId, cmdInfo.LockAccessType, operationContext);

                UserBinaryObject ubObject = (flagValueEntry == null) ? null : (UserBinaryObject) flagValueEntry.Value;

                //PROTOBUF:RESPONSE
                Alachisoft.NCache.Common.Protobuf.Response response = new Alachisoft.NCache.Common.Protobuf.Response();
                Alachisoft.NCache.Common.Protobuf.RemoveResponse removeResponse =
                    new Alachisoft.NCache.Common.Protobuf.RemoveResponse();
                response.responseType = Alachisoft.NCache.Common.Protobuf.Response.Type.REMOVE;
                response.remove = removeResponse;
                response.requestId = Convert.ToInt64(cmdInfo.RequestId);
                if (ubObject != null)
                {
                    removeResponse.value.AddRange(ubObject.DataList);
                    removeResponse.flag = flagValueEntry.Flag.Data;
                }
                _serializedResponsePackets.Add(Alachisoft.NCache.Common.Util.ResponseHelper.SerializeResponse(response));
            }
            catch (Exception exc)
            {
                _removeResult = OperationResult.Failure;

                //PROTOBUF:RESPONSE
                _serializedResponsePackets.Add(
                    Alachisoft.NCache.Common.Util.ResponseHelper.SerializeExceptionResponse(exc, command.requestID));
            }
            finally
            {
                if (ServerMonitor.MonitorActivity)
                    ServerMonitor.LogClientActivity("RemCmd.Exec", "cmd executed on cache");
            }
        }
开发者ID:javithalion,项目名称:NCache,代码行数:60,代码来源:RemoveCommand.cs


示例4: Convert

 public Alachisoft.ContentOptimization.Caching.Expiration Convert(Alachisoft.ContentOptimization.Caching.ExpirationType type)
 {
     var expiration = new Alachisoft.ContentOptimization.Caching.Expiration();
     expiration.ExpirationType = type;
     expiration.Duration = this.Duration.HasValue ? this.Duration.Value : 5;
     return expiration;
 }
开发者ID:javithalion,项目名称:NCache,代码行数:7,代码来源:ExpirationSettings.cs


示例5: ExecuteCommand

        //PROTOBUF
        public override void ExecuteCommand(ClientManager clientManager, Alachisoft.NCache.Common.Protobuf.ManagementCommand command)
        {
            object result = null;
            try
            {
                if (command.objectName == ManagementUtil.ManagementObjectName.CacheServer)
                {

                    result = CacheProvider.ManagementRpcService.InvokeMethodOnTarget(command.methodName,
                        command.overload,
                        GetTargetMethodParameters(command.arguments));
                }

                Alachisoft.NCache.Common.Protobuf.ManagementResponse response = new Alachisoft.NCache.Common.Protobuf.ManagementResponse();
                response.methodName = command.methodName;
                response.version = command.commandVersion;
                response.requestId = command.requestId;
                response.returnVal = SerializeResponse(result);

                _serializedResponsePackets.Add(Alachisoft.NCache.Common.Util.ResponseHelper.SerializeResponse(response));
            }
            catch (Exception exc)
            {
                _serializedResponsePackets.Add(Alachisoft.NCache.Common.Util.ResponseHelper.SerializeManagementExceptionResponse(exc, Convert.ToInt32(command.requestId)));
            }
        }
开发者ID:javithalion,项目名称:NCache,代码行数:27,代码来源:ManagementCommand.cs


示例6: ExecuteCommand

        //PROTOBUF
        public override void ExecuteCommand(ClientManager clientManager, Alachisoft.NCache.Common.Protobuf.Command command)
        {
            CommandInfo cmdInfo;

            try
            {
                cmdInfo = ParseCommand(command, clientManager);
            }
            catch (ArgumentOutOfRangeException arEx)
            {
                if (SocketServer.Logger.IsErrorLogsEnabled) SocketServer.Logger.NCacheLog.Error( "LockCommand", "command: " + command + " Error" + arEx);
                _lockResult = OperationResult.Failure;
                if (!base.immatureId.Equals("-2"))
                {
                    //PROTOBUF:RESPONSE
                    _serializedResponsePackets.Add(Alachisoft.NCache.Common.Util.ResponseHelper.SerializeExceptionResponse(arEx, command.requestID));
                }
                return;
            }
            catch (Exception exc)
            {
                _lockResult = OperationResult.Failure;
                if (!base.immatureId.Equals("-2"))
                {
                    //PROTOBUF:RESPONSE
                    _serializedResponsePackets.Add(Alachisoft.NCache.Common.Util.ResponseHelper.SerializeExceptionResponse(exc, command.requestID));
                }
                return;
            }

            try
            {
                NCache nCache = clientManager.CmdExecuter as NCache;
                object lockId = null;
                DateTime lockDate = DateTime.Now;

                bool res = nCache.Cache.Lock(cmdInfo.Key, cmdInfo.LockTimeout, out lockId, out lockDate, new OperationContext(OperationContextFieldName.OperationType, OperationContextOperationType.CacheOperation));

                //PROTOBUF:RESPONSE
                Alachisoft.NCache.Common.Protobuf.Response response = new Alachisoft.NCache.Common.Protobuf.Response();
                Alachisoft.NCache.Common.Protobuf.VerifyLockResponse verifyLockResponse = new Alachisoft.NCache.Common.Protobuf.VerifyLockResponse();
                response.requestId = Convert.ToInt64(cmdInfo.RequestId);
                response.responseType = Alachisoft.NCache.Common.Protobuf.Response.Type.LOCK_VERIFY;
                response.lockVerify = verifyLockResponse;

                verifyLockResponse.lockId = lockId.ToString();
                verifyLockResponse.success = res;
                verifyLockResponse.lockExpiration = lockDate.Ticks;

                _serializedResponsePackets.Add(Alachisoft.NCache.Common.Util.ResponseHelper.SerializeResponse(response));
            }
            catch (Exception exc)
            {
                _lockResult = OperationResult.Failure;

                //PROTOBUF:RESPONSE
                _serializedResponsePackets.Add(Alachisoft.NCache.Common.Util.ResponseHelper.SerializeExceptionResponse(exc, command.requestID));
            }
        }
开发者ID:javithalion,项目名称:NCache,代码行数:60,代码来源:VerifyLockCommand.cs


示例7: ExecuteCommand

        //PROTOBUF
        public override void ExecuteCommand(ClientManager clientManager, Alachisoft.NCache.Common.Protobuf.Command command)
        {
            CommandInfo cmdInfo;

            try
            {
                cmdInfo = ParseCommand(command, clientManager);
                if (ServerMonitor.MonitorActivity) ServerMonitor.LogClientActivity("UnlockCmd.Exec", "cmd parsed");

            }
            catch (ArgumentOutOfRangeException arEx)
            {
                if (SocketServer.Logger.IsErrorLogsEnabled) SocketServer.Logger.NCacheLog.Error("UnlockCommand", "command: " + command + " Error" + arEx);
                _unlockResult = OperationResult.Failure;
                if (!base.immatureId.Equals("-2"))
                {
                    //PROTOBUF:RESPONSE
                    _serializedResponsePackets.Add(Alachisoft.NCache.Common.Util.ResponseHelper.SerializeExceptionResponse(arEx, command.requestID));
                }
                return;
            }
            catch (Exception exc)
            {
                _unlockResult = OperationResult.Failure;
                if (!base.immatureId.Equals("-2"))
                {
                    //PROTOBUF:RESPONSE
                    _serializedResponsePackets.Add(Alachisoft.NCache.Common.Util.ResponseHelper.SerializeExceptionResponse(exc, command.requestID));
                }
                return;
            }

            try
            {
                NCache nCache = clientManager.CmdExecuter as NCache;

                nCache.Cache.Unlock(cmdInfo.Key, cmdInfo.lockId, cmdInfo.isPreemptive, new OperationContext(OperationContextFieldName.OperationType, OperationContextOperationType.CacheOperation));

                //PROTOBUF:RESPONSE
                Alachisoft.NCache.Common.Protobuf.Response response = new Alachisoft.NCache.Common.Protobuf.Response();
                Alachisoft.NCache.Common.Protobuf.UnlockResponse unlockResponse = new Alachisoft.NCache.Common.Protobuf.UnlockResponse();
                response.requestId = Convert.ToInt64(cmdInfo.RequestId);
                response.responseType = Alachisoft.NCache.Common.Protobuf.Response.Type.UNLOCK;
                response.unlockResponse = unlockResponse;

                _serializedResponsePackets.Add(Alachisoft.NCache.Common.Util.ResponseHelper.SerializeResponse(response));

            }
            catch (Exception exc)
            {
                _unlockResult = OperationResult.Failure;
                _serializedResponsePackets.Add(clientManager.ReplyPacket(base.ExceptionPacket(exc, cmdInfo.RequestId), base.ExceptionMessage(exc)));
            }
            finally
            {
                if (ServerMonitor.MonitorActivity) ServerMonitor.LogClientActivity("UnlockCmd.Exec", "cmd executed on cache");

            }
        }
开发者ID:javithalion,项目名称:NCache,代码行数:60,代码来源:UnlockCommand.cs


示例8: ConvertToProtobufEnumerationPointer

 public static Alachisoft.NCache.Common.Protobuf.EnumerationPointer ConvertToProtobufEnumerationPointer(Alachisoft.NCache.Common.DataStructures.EnumerationPointer pointer)
 {
     Alachisoft.NCache.Common.Protobuf.EnumerationPointer enumerationPointer = new Alachisoft.NCache.Common.Protobuf.EnumerationPointer();
     enumerationPointer.chunkId = pointer.ChunkId;
     enumerationPointer.id = pointer.Id;
     enumerationPointer.isDisposed = pointer.isDisposable;
     return enumerationPointer;
 }
开发者ID:javithalion,项目名称:NCache,代码行数:8,代码来源:EnumerationPointerConversionUtil.cs


示例9: ExecuteCommand

        //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"))
                    //_resultPacket = clientManager.ReplyPacket(base.ExceptionPacket(exc, base.immatureId), base.ParsingExceptionMessage(exc));
                    _serializedResponsePackets.Add(Alachisoft.NCache.Common.Util.ResponseHelper.SerializeExceptionResponse(exc, command.requestID));
                return;
            }

            try
            {
                //Fetch mapped servers

                ServerMapping serverMapping = Management.MappingConfiguration.MappingConfigurationManager.GetMappingConfiguration().ClientIPMapping;
                Mapping[] mappedServers = serverMapping.MappingServers;

                Alachisoft.NCache.Common.Protobuf.Response response = new Alachisoft.NCache.Common.Protobuf.Response();
                Alachisoft.NCache.Common.Protobuf.GetServerMappingResponse getServerMappingResponse = new Alachisoft.NCache.Common.Protobuf.GetServerMappingResponse();

                if (mappedServers != null)
                {
                    for (int i = 0; i < mappedServers.Length; i++)
                    {
                        Common.Protobuf.ServerMapping mappingObject = new Common.Protobuf.ServerMapping();
                        //Map the server list to protobuf object
                        mappingObject.privateIp = mappedServers[i].PrivateIP;
                        mappingObject.privatePort = mappedServers[i].PrivatePort;
                        mappingObject.publicIp = mappedServers[i].PublicIP;
                        mappingObject.publicPort = mappedServers[i].PublicPort;

                        //Adding to list to be sent as a response
                        getServerMappingResponse.serverMapping.Add(mappingObject);

                    }
                }
                else
                    SocketServer.Logger.NCacheLog.Error("Server Mapping is null");

                response.getServerMappingResponse = getServerMappingResponse;
                response.responseType = Alachisoft.NCache.Common.Protobuf.Response.Type.GET_SERVER_MAPPING;
                response.requestId = command.requestID;

                _serializedResponsePackets.Add(Alachisoft.NCache.Common.Util.ResponseHelper.SerializeResponse(response));

            }
            catch (Exception exc)
            {
                //_resultPacket = clientManager.ReplyPacket(base.ExceptionPacket(exc, cmdInfo.RequestId), base.ExceptionMessage(exc));
                _serializedResponsePackets.Add(Alachisoft.NCache.Common.Util.ResponseHelper.SerializeExceptionResponse(exc, command.requestID));
            }
        }
开发者ID:javithalion,项目名称:NCache,代码行数:59,代码来源:GetServerMappingCommand.cs


示例10: NagglingManager

 internal NagglingManager(Connection parent, Socket workingSocket, Alachisoft.NCache.Common.DataStructures.Queue msgQueue, long nagglingSize, object syncLock)
 {
     _parent = parent;
     _workingSocket = workingSocket;
     _nagglingSize = nagglingSize;
     _msgQueue = msgQueue;
     _sendBuffer = new byte[_sendBufferSize];
     _syncLock = syncLock;
 }
开发者ID:javithalion,项目名称:NCache,代码行数:9,代码来源:NagglingManager.cs


示例11: UpHandler

 public UpHandler(Alachisoft.NCache.Common.DataStructures.Queue mq, Protocol handler, string name, int id)
 {
     this.mq = mq;
     this.handler = handler;
     if(name != null)
         Name = name;
     IsBackground = true;
     this.id = id;
 }
开发者ID:javithalion,项目名称:NCache,代码行数:9,代码来源:Protocol.cs


示例12: ExecuteCommand

        public override void ExecuteCommand(ClientManager clientManager, Alachisoft.NCache.Common.Protobuf.Command command)
        {
            CommandInfo cmdInfo;
            ClientId = clientManager.ClientID; //Asif Imam

            NCache nCache = clientManager.CmdExecuter as NCache;
            try
            {
                serailizationContext = nCache.CacheId;
                cmdInfo = base.ParseCommand(command, clientManager, serailizationContext);
                if (ServerMonitor.MonitorActivity) ServerMonitor.LogClientActivity("BulkInsCmd.Exec", "cmd parsed");
            }
            catch (Exception exc)
            {
                _insertBulkResult = OperationResult.Failure;
                //if (!base.immatureId.Equals("-2"))
                {
                    //PROTOBUF:RESPONSE
                    _serializedResponsePackets.Add(Alachisoft.NCache.Common.Util.ResponseHelper.SerializeExceptionResponse(exc, command.requestID));
                }
                return;
            }

            //TODO
            byte[] dataPackage = null;

            try
            {
                OperationContext operationContext = new OperationContext(OperationContextFieldName.OperationType, OperationContextOperationType.CacheOperation);
                operationContext.Add(OperationContextFieldName.ClientLastViewId, cmdInfo.ClientLastViewId);
                if (!string.IsNullOrEmpty(cmdInfo.IntendedRecipient))
                    operationContext.Add(OperationContextFieldName.IntendedRecipient, cmdInfo.IntendedRecipient);

                Hashtable insertResult = (Hashtable)nCache.Cache.Insert(cmdInfo.Keys, cmdInfo.Values, cmdInfo.CallbackEnteries, cmdInfo.ExpirationHint, cmdInfo.EvictionHint, cmdInfo.QueryInfo, cmdInfo.Flags, operationContext);
                Alachisoft.NCache.Common.Protobuf.Response response = new Alachisoft.NCache.Common.Protobuf.Response();
                Alachisoft.NCache.Common.Protobuf.BulkInsertResponse bulkInsertResponse = new Alachisoft.NCache.Common.Protobuf.BulkInsertResponse();
				response.requestId = Convert.ToInt64(cmdInfo.RequestId);
                response.intendedRecipient = cmdInfo.IntendedRecipient;
                bulkInsertResponse.keyExceptionPackage = new Alachisoft.NCache.Common.Protobuf.KeyExceptionPackageResponse();

                //TODO : Package Key Value
                Alachisoft.NCache.SocketServer.Util.KeyPackageBuilder.PackageKeysExceptions(insertResult, bulkInsertResponse.keyExceptionPackage);

                response.responseType = Alachisoft.NCache.Common.Protobuf.Response.Type.INSERT_BULK;
                response.bulkInsert = bulkInsertResponse;
                _serializedResponsePackets.Add(Alachisoft.NCache.Common.Util.ResponseHelper.SerializeResponse(response));

            }
            catch (Exception exc)
            {
                _insertBulkResult = OperationResult.Failure;
                //PROTOBUF:RESPONSE
                _serializedResponsePackets.Add(Alachisoft.NCache.Common.Util.ResponseHelper.SerializeExceptionResponse(exc, command.requestID));
            }
            if (ServerMonitor.MonitorActivity) ServerMonitor.LogClientActivity("BulkInsCmd.Exec", "cmd executed on cache");

        }
开发者ID:christrotter,项目名称:NCache,代码行数:57,代码来源:BulkInsertCommand.cs


示例13: ExecuteCommand

        //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"))
                    _serializedResponsePackets.Add(Alachisoft.NCache.Common.Util.ResponseHelper.SerializeExceptionResponse(exc, command.requestID));
                return;
            }

            try
            {
                NCache nCache = clientManager.CmdExecuter as NCache;
                int bucketSize = 0;
                NewHashmap hashmap = nCache.Cache.GetOwnerHashMap(out bucketSize);
                byte[] buffer = new byte[0];

                //TODO:Incomplete conversion
                Alachisoft.NCache.Common.Protobuf.Response response = new Alachisoft.NCache.Common.Protobuf.Response();
                Alachisoft.NCache.Common.Protobuf.GetHashmapResponse getHashmapResponse = new Alachisoft.NCache.Common.Protobuf.GetHashmapResponse();

                response.getHashmap = getHashmapResponse;
                response.responseType = Alachisoft.NCache.Common.Protobuf.Response.Type.GET_HASHMAP;
                response.requestId = command.requestID;

                if (hashmap != null)
                {
                    getHashmapResponse.viewId = hashmap.LastViewId;
                    getHashmapResponse.bucketSize = bucketSize;

                    foreach (string member in hashmap.Members)
                    {
                        getHashmapResponse.members.Add(member);
                    }
                    foreach (DictionaryEntry entry in hashmap.Map)
                    {
                        Alachisoft.NCache.Common.Protobuf.KeyValuePair keyValue =
                            new Alachisoft.NCache.Common.Protobuf.KeyValuePair();
                        keyValue.key = entry.Key.ToString();
                        keyValue.value = entry.Value.ToString();

                        getHashmapResponse.keyValuePair.Add(keyValue);
                    }
                }
                _serializedResponsePackets.Add(Alachisoft.NCache.Common.Util.ResponseHelper.SerializeResponse(response));
            }
            catch (Exception exc)
            {
                _serializedResponsePackets.Add(Alachisoft.NCache.Common.Util.ResponseHelper.SerializeExceptionResponse(exc, command.requestID));
            }
        }
开发者ID:javithalion,项目名称:NCache,代码行数:57,代码来源:GetHashmapCommand.cs


示例14: ExecuteCommand

        //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;
            }

            try
            {
                CallbackInfo cbUpdate = null;
                CallbackInfo cbRemove = null;

                if(cmdInfo.dataFilter != -1) //Default value in protbuf set to -1
                {
                    EventDataFilter datafilter = (EventDataFilter)cmdInfo.dataFilter;

                    cbUpdate = new CallbackInfo(clientManager.ClientID, cmdInfo.UpdateCallbackId, datafilter);
                    cbRemove = new CallbackInfo(clientManager.ClientID, cmdInfo.RemoveCallbackId, datafilter, cmdInfo.NotifyOnExpiration);
                }
                else
                {
                    cbUpdate = new CallbackInfo(clientManager.ClientID, cmdInfo.UpdateCallbackId, EventDataFilter.None);
                    cbRemove = new CallbackInfo(clientManager.ClientID, cmdInfo.RemoveCallbackId,EventDataFilter.DataWithMetadata, cmdInfo.NotifyOnExpiration);
                }

                NCache nCache = clientManager.CmdExecuter as NCache;

                nCache.Cache.RegisterKeyNotificationCallback(cmdInfo.Key, cbUpdate, cbRemove
                  , new OperationContext(OperationContextFieldName.OperationType, OperationContextOperationType.CacheOperation));

                //PROTOBUF:RESPONSE
                Alachisoft.NCache.Common.Protobuf.Response response = new Alachisoft.NCache.Common.Protobuf.Response();
                Alachisoft.NCache.Common.Protobuf.RegisterKeyNotifResponse registerKeyNotifResponse = new Alachisoft.NCache.Common.Protobuf.RegisterKeyNotifResponse();
                response.responseType = Alachisoft.NCache.Common.Protobuf.Response.Type.REGISTER_KEY_NOTIF;
                response.registerKeyNotifResponse = registerKeyNotifResponse;
                response.requestId = command.registerKeyNotifCommand.requestId;
                _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));
            }
        }
开发者ID:javithalion,项目名称:NCache,代码行数:57,代码来源:RegisterKeyNotifcationCommand.cs


示例15: ParseCommand

        //PROTOBUF
        private CommandInfo ParseCommand(Alachisoft.NCache.Common.Protobuf.Command command, ClientManager clientManager)
        {
            CommandInfo cmdInfo = new CommandInfo();

            Alachisoft.NCache.Common.Protobuf.ClearCommand clearCommand= command.clearCommand;
            cmdInfo.FlagMap = new BitSet((byte)clearCommand.flag);
            cmdInfo.RequestId = clearCommand.requestId.ToString();

            return cmdInfo;
        }
开发者ID:javithalion,项目名称:NCache,代码行数:11,代码来源:ClearCommand.cs


示例16: ParseCommand

        //PROTOBUF
        private CommandInfo ParseCommand(Alachisoft.NCache.Common.Protobuf.Command command, ClientManager clientManager)
        {
            CommandInfo cmdInfo = new CommandInfo();

            Alachisoft.NCache.Common.Protobuf.CountCommand countCommand = command.countCommand;

            cmdInfo.RequestId = countCommand.requestId.ToString();

            return cmdInfo;
        }
开发者ID:javithalion,项目名称:NCache,代码行数:11,代码来源:CountCommand.cs


示例17: ExecuteCommand

        //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"))
                    _serializedResponsePackets.Add(Alachisoft.NCache.Common.Util.ResponseHelper.SerializeExceptionResponse(exc, command.requestID));
                return;
            }

            Cache cache = null;

            try
            {
                string server = ConnectionManager.ServerIpAddress;
                int port = ConnectionManager.ServerPort;

                Dictionary<string, int> runningServers = new Dictionary<string, int>();

                cache = CacheProvider.Provider.GetCacheInstanceIgnoreReplica(cmdInfo.CacheId);

                if (cache == null) throw new Exception("Cache is not registered");
                if (!cache.IsRunning) throw new Exception("Cache is not running");

                runningServers = cache.GetRunningServers(server, port);
                Alachisoft.NCache.Common.Protobuf.Response response = new Alachisoft.NCache.Common.Protobuf.Response();
                Alachisoft.NCache.Common.Protobuf.GetRunningServersResponse getRunningServerResponse = new Alachisoft.NCache.Common.Protobuf.GetRunningServersResponse();

                if (runningServers != null)
                {
                    Dictionary<string, int>.Enumerator ide = runningServers.GetEnumerator();
                    while (ide.MoveNext())
                    {
                        Common.Protobuf.KeyValuePair pair = new Common.Protobuf.KeyValuePair();
                        pair.key = ide.Current.Key;
                        pair.value = ide.Current.Value.ToString();
                        getRunningServerResponse.keyValuePair.Add(pair);
                    }
                }

                response.requestId = Convert.ToInt64(cmdInfo.RequestId);
                response.getRunningServer = getRunningServerResponse;
                response.responseType = Alachisoft.NCache.Common.Protobuf.Response.Type.GET_RUNNING_SERVERS;

                _serializedResponsePackets.Add(Alachisoft.NCache.Common.Util.ResponseHelper.SerializeResponse(response));
            }
            catch (Exception exc)
            {
                _serializedResponsePackets.Add(Alachisoft.NCache.Common.Util.ResponseHelper.SerializeExceptionResponse(exc, command.requestID));
            }
        }
开发者ID:javithalion,项目名称:NCache,代码行数:56,代码来源:GetRunningServersCommand.cs


示例18: ParseCommand

        //PROTOBUF
        private CommandInfo ParseCommand(Alachisoft.NCache.Common.Protobuf.Command command, ClientManager clientManager)
        {
            CommandInfo cmdInfo = new CommandInfo();

            Alachisoft.NCache.Common.Protobuf.GetRunningServersCommand getRunningServerCommand = command.getRunningServersCommand;

            cmdInfo.CacheId = getRunningServerCommand.cacheId;
            cmdInfo.IsDotNetClient = getRunningServerCommand.isDotnetClient;
            cmdInfo.RequestId = getRunningServerCommand.requestId.ToString();
            return cmdInfo;
        }
开发者ID:javithalion,项目名称:NCache,代码行数:12,代码来源:GetRunningServersCommand.cs


示例19: ParseCommand

        private CommandInfo ParseCommand(Alachisoft.NCache.Common.Protobuf.Command command)
        {
            CommandInfo cmdInfo = new CommandInfo();

            Alachisoft.NCache.Common.Protobuf.AddAttributeCommand addAttributeCommand = command.addAttributeCommand;
            cmdInfo.ExpHint = Alachisoft.NCache.Caching.Util.ProtobufHelper.GetExpirationHintObj(addAttributeCommand.absExpiration, 0, serializationContext);
            cmdInfo.Key = addAttributeCommand.key;
            cmdInfo.RequestId = addAttributeCommand.requestId.ToString();

            return cmdInfo;
        }
开发者ID:javithalion,项目名称:NCache,代码行数:11,代码来源:AddAttributeCommand.cs


示例20: ExecuteCommand

        //PROTOBUF
        public override void ExecuteCommand(ClientManager clientManager, Alachisoft.NCache.Common.Protobuf.Command command)
        {
            CommandInfo cmdInfo;

            try
            {
                cmdInfo = ParseCommand(command, clientManager);
            }
            catch (ArgumentOutOfRangeException arEx)
            {
                if (SocketServer.Logger.IsErrorLogsEnabled) SocketServer.Logger.NCacheLog.Error( "IsLockedCommand", "command: " + command + " Error" + arEx);
                if (!base.immatureId.Equals("-2"))
                {
                    _serializedResponsePackets.Add(Alachisoft.NCache.Common.Util.ResponseHelper.SerializeExceptionResponse(arEx, command.requestID));
                }
                return;
            }
            catch (Exception exc)
            {
                if (!base.immatureId.Equals("-2"))
                {
                    //PROTOBUF:RESPONSE
                    _serializedResponsePackets.Add(Alachisoft.NCache.Common.Util.ResponseHelper.SerializeExceptionResponse(exc, command.requestID));
                }
                return;
            }

            try
            {
                NCache nCache = clientManager.CmdExecuter as NCache;
                object lockId = cmdInfo.LockId;
                DateTime lockDate = new DateTime();

                bool res = nCache.Cache.IsLocked(cmdInfo.Key, ref lockId, ref lockDate, new OperationContext(OperationContextFieldName.OperationType, OperationContextOperationType.CacheOperation));

                //PROTOBUF:RESPONSE
                Alachisoft.NCache.Common.Protobuf.Response response = new Alachisoft.NCache.Common.Protobuf.Response();
                Alachisoft.NCache.Common.Protobuf.IsLockedResponse isLockedResponse = new Alachisoft.NCache.Common.Protobuf.IsLockedResponse();
                response.requestId = Convert.ToInt64(cmdInfo.RequestId);
                response.responseType = Alachisoft.NCache.Common.Protobuf.Response.Type.ISLOCKED;
                response.isLockedResponse = isLockedResponse;

                isLockedResponse.isLocked = res;
                isLockedResponse.lockId = lockId.ToString();
                isLockedResponse.lockTime = lockDate.Ticks;

                _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));
            }
        }
开发者ID:javithalion,项目名称:NCache,代码行数:55,代码来源:IsLockedCommand.cs



注:本文中的Alachisoft类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Album类代码示例发布时间:2022-05-24
下一篇:
C# AkCurveInterpolation类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap