当前位置: 首页>>代码示例>>C#>>正文


C# RedisValue.ToString方法代码示例

本文整理汇总了C#中RedisValue.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# RedisValue.ToString方法的具体用法?C# RedisValue.ToString怎么用?C# RedisValue.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在RedisValue的用法示例。


在下文中一共展示了RedisValue.ToString方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ListenForMessage

 public void ListenForMessage(RedisChannel channel, RedisValue value)
 {
     Assert.AreEqual(RedisKey, channel.ToString());
     Assert.IsFalse(!value.HasValue || value.IsNullOrEmpty);
     Assert.AreEqual("INFO test pub/sub message", value.ToString());
     ActionRun = true;
 }
开发者ID:roh85,项目名称:NLog.Redis,代码行数:7,代码来源:RedisTargetTests.cs

示例2: GetMessageUpdates

        private static void GetMessageUpdates(RedisChannel channel, RedisValue value)
        {
            var vals = value.ToString().Split('|');
            if (vals.Length != 3 || vals[0] == InstanceId) return;

            GlobalHost.ConnectionManager.GetHubContext<ChatHub>().Clients.All.receiveMessage(vals[1], vals[2]);
        }
开发者ID:Abdullah2993,项目名称:Klepet,代码行数:7,代码来源:ChatHub.cs

示例3: GetConnectionUpdates

        private static void GetConnectionUpdates(RedisChannel channel, RedisValue value)
        {
            var vals = value.ToString().Split('|');
            if (vals.Length != 3 || vals[1] == InstanceId) return;

            if (vals[0] == "1")
            {
                GlobalHost.ConnectionManager.GetHubContext<ChatHub>().Clients.All.clientConnected(vals[2]);
            }
            else if (vals[0] == "0")
            {
                GlobalHost.ConnectionManager.GetHubContext<ChatHub>().Clients.All.clientDisconnected(vals[2]);
            }
        }
开发者ID:Abdullah2993,项目名称:Klepet,代码行数:14,代码来源:ChatHub.cs

示例4: OnInvalidationMessage

 private void OnInvalidationMessage(RedisChannel pattern, RedisValue data)
 {
     if (pattern == Constants.DEFAULT_INVALIDATION_CHANNEL)
     {
         this.ProcessInvalidationMessage(data.ToString());
     }
 }
开发者ID:gopimails,项目名称:RedisMemoryCacheInvalidation,代码行数:7,代码来源:RedisNotificationBus.cs

示例5: OnKeySpaceNotificationMessage

 private void OnKeySpaceNotificationMessage(RedisChannel pattern, RedisValue data)
 {
     var prefix = pattern.ToString().Substring(0, 10);
     switch (prefix)
     {
         case "__keyevent":
             this.ProcessInvalidationMessage(data.ToString());
             break;
         default:
             //nop
             break;
     }
 }
开发者ID:gopimails,项目名称:RedisMemoryCacheInvalidation,代码行数:13,代码来源:RedisNotificationBus.cs

示例6: onMessage

        private void onMessage(RedisChannel channel, RedisValue value)
        {
            log(Logging.LoggingLevel.Detailed, "Received Message: {0}", value.ToString());

            var dict = value.ToString().ToObject<Dictionary<string, string>>();
            if (OnMessage != null)
                OnMessage(dict["cacheName"], dict["message"]);
        }
开发者ID:jonhenning,项目名称:CodeEndeavors-DistributedCache,代码行数:8,代码来源:RedisNotifier.cs

示例7: onExpireItemCache

        private void onExpireItemCache(RedisChannel channel, RedisValue value)
        {
            log(Logging.LoggingLevel.Detailed, "Received Expire Item: {0}", value.ToJson());

            var dict = value.ToString().ToObject<Dictionary<string, string>>();
            if (OnExpireItem != null)
                OnExpireItem(dict["cacheName"], dict["key"], dict["itemKey"]);
        }
开发者ID:jonhenning,项目名称:CodeEndeavors-DistributedCache,代码行数:8,代码来源:RedisNotifier.cs

示例8: ProcessRedisCacheInstruction

 private void ProcessRedisCacheInstruction(RedisChannel channel, RedisValue message )
 {
     string[] messageParts = message.ToString().Split( ',' );
     if (messageParts.Length > 0 )
     {
         var action = messageParts[0];
         switch ( action )
         {
             case "REMOVE":
                 {
                     if (messageParts.Length > 1 )
                     {
                         RemoveFromMemoryCache( messageParts[1] );
                     }
                     break;
                 }
             case "FLUSH":
                 {
                     FlushMemoryCache();
                     break;
                 }
             case "REFRESH_AUTH_ENTITY":
                 {
                     if ( messageParts.Length > 2 )
                     {
                         Rock.Security.Authorization.RefreshEntity( messageParts[1].AsInteger(), messageParts[2].AsInteger() );
                     }
                     break;
                 }
             case "REFRESH_AUTH_ACTION":
                 {
                     if ( messageParts.Length > 3 )
                     {
                         Rock.Security.Authorization.RefreshAction( messageParts[1].AsInteger(), messageParts[2].AsInteger(), messageParts[3] );
                     }
                     break;
                 }
             case "FLUSH_AUTH":
                 {
                     Rock.Security.Authorization.FlushAuth();
                     break;
                 }
             case "REMOVE_ENTITY_ATTRIBUTES":
                 {
                     Rock.Web.Cache.AttributeCache.RemoveEntityAttributes();
                     break;
                 }
             case "PING":
                 {
                     var response = string.Format( "PONG: From {0}: {1}", System.Environment.MachineName, System.AppDomain.CurrentDomain.FriendlyName );
                     SendRedisCommand( response );
                     break;
                 }
         }
     }
 }
开发者ID:NewSpring,项目名称:Rock,代码行数:56,代码来源:RockMemoryCache.cs

示例9: ToString

 public override string ToString()
 {
     if (_params == null)
         return base.ToString();
     var multi = new RedisValue { Type = RedisValueType.MultiBulk, MultiBulkValues = _params };
     return multi.ToString();
 }
开发者ID:vebin,项目名称:Guanima.Redis,代码行数:7,代码来源:RedisCommand.cs

示例10: MasterWasSwitched

				private void MasterWasSwitched(RedisChannel redisChannel, RedisValue redisValue)
        {
	        _connection.ConnectionFailed -= OnConnectionFailed;
	        _connection.ConnectionRestored -= OnConnectionRestored;
	        _connection.ErrorMessage -= OnError;
          _connection.Close();
          if (redisValue.IsNullOrEmpty) return;
          var message = redisValue.ToString();
          var messageParts = message.Split(' ');
          var ip = IPAddress.Parse(messageParts[3]);
          var port = int.Parse(messageParts[4]);
          EndPoint newMasterEndpoint = new IPEndPoint(ip, port);
          if (_options.EndPoints.Any() && newMasterEndpoint == _options.EndPoints[0]) return;
          _options.EndPoints.Clear();
          _options.EndPoints.Add(newMasterEndpoint);

          _connection = ConnectionMultiplexer.Connect(_options);
          _connection.ConnectionFailed += OnConnectionFailed;
          _connection.ConnectionRestored += OnConnectionRestored;
          _connection.ErrorMessage += OnError;
          _redisSubscriber = _connection.GetSubscriber();
          var handler = ConnectionRestored;
          if (handler != null) handler(new ApplicationException("Redis master was switched"));
        }
开发者ID:MATTCASH83,项目名称:SignalR,代码行数:24,代码来源:RedisConnection.cs

示例11: WaitChannelPulse

        private void WaitChannelPulse(RedisChannel redisChannel, RedisValue redisValue)
        {
            lock (this.waitLock)
            {
                if (this.wasWaitPulsed)
                {
                    // somehow we got message that we shouldn't get
                    return;
                }

                try
                {
                    this.wasWaitPulsed = true;
                    var pulseType = (PulseType)(int.Parse(redisValue.ToString()));
                    if (pulseType == PulseType.One)
                    {
                        // try get permission to wake
                        try
                        {
                            this.redisStorage.Remove(this.PulseFile);
                        }
                        catch (StorageKeyDoesntExistException)
                        {
                            // failed - need to sleep longer
                            return;
                        }
                    }

                    // unsubscribe yourself
                    this.redisStorage.Unsubscribe(this.WaitChannel, this.WaitChannelPulse);
                    Monitor.Pulse(this.waitLock);
                }
                finally
                {
                    this.wasWaitPulsed = false;
                }
            }
        }
开发者ID:pbazydlo,项目名称:bluepath,代码行数:38,代码来源:RedisLock.cs

示例12: Handler

        /// <summary>
        /// Handlers the specified redis channel.
        /// </summary>
        /// <param name="redisChannel">The redis channel.</param>
        /// <param name="redisValue">The redis value.</param>
        private void Handler(RedisChannel redisChannel, RedisValue redisValue)
        {
            if (!redisValue.HasValue || _messageId.Id.Value.ToString() != redisValue.ToString())
            {
                return;
            }

            _waitHandle.Set();
        }
开发者ID:blehnen,项目名称:DotNetWorkQueue,代码行数:14,代码来源:RedisQueueWorkSubRpc.cs

示例13: MasterWasSwitched

        private void MasterWasSwitched(RedisChannel redisChannel, RedisValue redisValue)
        {
            if (redisValue.IsNullOrEmpty) return;
              var message = redisValue.ToString();
              var messageParts = message.Split(' ');
              var ip = IPAddress.Parse(messageParts[3]);
              var port = int.Parse(messageParts[4]);
              EndPoint newMasterEndpoint = new IPEndPoint(ip, port);
              if (_configOption.EndPoints.Any() && newMasterEndpoint == _configOption.EndPoints[0]) return;
              _configOption.EndPoints.Clear();
              _configOption.EndPoints.Add(newMasterEndpoint);

              _redisMultiplexer = LogUtility.logger == null
            ? ConnectionMultiplexer.Connect(_configOption)
            : ConnectionMultiplexer.Connect(_configOption, LogUtility.logger);

              _connection = _redisMultiplexer.GetDatabase(_configuration.DatabaseId);
        }
开发者ID:McMlok,项目名称:aspnet-redis-providers,代码行数:18,代码来源:StackExchangeClientConnection.cs


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