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


C# BookSleeve.RedisConnection类代码示例

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


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

示例1: GetRedisConnection

        private static async Task<RedisConnection> GetRedisConnection(string host)
        {
            RedisConnection c = new RedisConnection(host);
            await c.Open();
            return c;

        }
开发者ID:ryantomlinson,项目名称:EventStreamR,代码行数:7,代码来源:RedisBooksleevePersistence.cs

示例2: RedisBooksleevePersistence

 public RedisBooksleevePersistence()
 {
     if (conn == null)
     {
         conn = GetRedisConnection("localhost").Result;
     }
 }
开发者ID:ryantomlinson,项目名称:EventStreamR,代码行数:7,代码来源:RedisBooksleevePersistence.cs

示例3: Setup

 public void Setup()
 {
     var connection = new RedisConnection("127.0.0.1", allowAdmin: true);
     connection.Open();
     connection.Server.FlushDb(0);
     connection.Close(false);
 }
开发者ID:kumaie,项目名称:AspNetRedisProviders,代码行数:7,代码来源:RoleProviderTests.cs

示例4: PerformBitOperation

        internal async Task<long> PerformBitOperation(
            RedisConnection connection)
        {
            var keys = new[] { LeftKey, RightKey };

            if ("AND".Equals(Operation, StringComparison.Ordinal))
            {
                return await connection.Strings.BitwiseAnd(Db, Key, keys);
            }
            
            if ("OR".Equals(Operation, StringComparison.Ordinal))
            {
                return await connection.Strings.BitwiseOr(Db, Key, keys);
            }

            if ("XOR".Equals(Operation, StringComparison.Ordinal))
            {
                return await connection.Strings.BitwiseXOr(Db, Key, keys);
            }

            throw new InvalidOperationException(
                string.Format(
                    CultureInfo.CurrentUICulture,
                    ErrorMessages.CompositeUserActivityReport_PerformBitOperation_Unsupported,
                    Operation));
        }
开发者ID:jesusgarza,项目名称:MinutemanDotNet,代码行数:26,代码来源:CompositeUserActivityReport.cs

示例5: foo

 public static void foo()
 {
     using (var redis = new RedisConnection("goosefish.redistogo.com", 9836, -1, "88f5c87381f5564b18b4ecba2647e9ab")) {
         redis.Open();
         redis.Lists.AddLast(1, "w00t", "t00t");
     }
 }
开发者ID:timothypratley,项目名称:locstream,代码行数:7,代码来源:EventRecorder.cs

示例6: RedisSignalBus

 public RedisSignalBus(RedisConnection redisConnection)
 {
     _handlers = new ConcurrentDictionary<string, SafeSet<EventHandler<SignaledEventArgs>>>();
     _redisConnection = redisConnection;
     _subscriberConnection = _redisConnection.GetOpenSubscriberChannel();
     _subscriberConnection.MessageReceived += OnRedisMessageReceived;
 }
开发者ID:JasonPunyon,项目名称:SignalR,代码行数:7,代码来源:RedisSignalBus.cs

示例7: ConnectionReady

        private bool ConnectionReady()
        {
            if (_redisConnection == null || _redisConnection.State != RedisConnectionBase.ConnectionState.Open)
            {
                lock (_connectionLock)
                {
                    if (_redisConnection == null || _redisConnection.State != RedisConnectionBase.ConnectionState.Open)
                    {
                        _redisConnection = new RedisConnection(Host, Port, password: Password, maxUnsent: 1);

                        try
                        {
                            _redisConnection.Open().Wait();
                            return true;                
                        } 
                        catch (Exception ex)
                        {
                            return false;
                        }
                    }
                }
            }

            return true;
        }
开发者ID:Rustemt,项目名称:SignalR.Redis,代码行数:25,代码来源:RedisMessageStore.cs

示例8: GetBrushActions

 public List<CanvasBrushAction> GetBrushActions(string canvasId, int currentPosition)
 {
     List<CanvasBrushAction> actions = new List<CanvasBrushAction>();
     string[] storedActions = null;
     using (var conn = new RedisConnection(_redisConfiguration.HostName, _redisConfiguration.
     Port, password: _redisConfiguration.Password))
     {
         conn.Open();
         var rangeTask = conn.Lists.RangeString(0, ACTION_PREFIX + canvasId, currentPosition,
         Int32.MaxValue);
         storedActions = rangeTask.Result;
     }
     if (storedActions != null)
     {
         foreach (string storedAction in storedActions)
         {
             actions.Add(JsonConvert.DeserializeObject<CanvasBrushAction>(storedAction));
         }
         actions.Sort(new Comparison<CanvasBrushAction>((a, b) =>
         {
             return a.Sequence.
                 CompareTo(b.Sequence);
         }));
     }
     return actions;
 }
开发者ID:asifashraf,项目名称:proSignalR,代码行数:26,代码来源:RedisStorage.cs

示例9: CanNotOpenNonsenseConnection

 public void CanNotOpenNonsenseConnection()
 {
     using (var conn = new RedisConnection("127.0.0.1", 6500))
     {
         conn.Wait(conn.Open());
     }
 }
开发者ID:rhagigi,项目名称:Booksleeve,代码行数:7,代码来源:Config.cs

示例10: CanNotOpenNonsenseConnection_IP

 public void CanNotOpenNonsenseConnection_IP()
 {
     using (var conn = new RedisConnection(Config.LocalHost, 6500))
     {
         conn.Wait(conn.Open());
     }
 }
开发者ID:raycode,项目名称:booksleeve,代码行数:7,代码来源:Config.cs

示例11: GetOpen

        public RedisConnection GetOpen()
        {
            lock (syncConnection)
            {
                if (_Connection != null && !(_Connection.State == RedisConnectionBase.ConnectionState.Closed || _Connection.State == RedisConnectionBase.ConnectionState.Closing))
                {
                    return _Connection;
                }

                if (_Connection == null || (_Connection.State == RedisConnectionBase.ConnectionState.Closed || _Connection.State == RedisConnectionBase.ConnectionState.Closing))
                {
                    try
                    {
                        RoqueTrace.Source.Trace(TraceEventType.Information, "[REDIS] connecting to {0}:{1}", _Host, _Port);

                        _Connection = new RedisConnection(_Host, _Port, _Timeout);
                        var openAsync = _Connection.Open();
                        _Connection.Wait(openAsync);

                        RoqueTrace.Source.Trace(TraceEventType.Information, "[REDIS] connected");
                    }
                    catch (Exception ex)
                    {
                        RoqueTrace.Source.Trace(TraceEventType.Error, "[REDIS] error connecting to {0}:{1}, {2}", _Host, _Port, ex.Message, ex);
                        throw;
                    }
                }
                return _Connection;
            }
        }
开发者ID:BlogTalkRadio,项目名称:Roque,代码行数:30,代码来源:RedisLiveConnection.cs

示例12: Test

        public void Test()
        {
            Debug.WriteLine("Iniciando");

            using (var conn = new RedisConnection("localhost"))
            {
                conn.Open();
                conn.Strings.Set(0, "nome", "joão");
            }

            Thread.Sleep(2000);

            using (var conn = new RedisConnection("localhost", 6380))
            {
                conn.Open();
                conn.Strings.GetString(0, "nome").Result.ShouldEqual("joão");
            }

            this.redisMaster.Kill();

            Thread.Sleep(2000);

            using (var conn = new RedisConnection("localhost", 6380))
            {
                conn.Open();
                conn.Strings.GetString(0, "nome").Result.ShouldEqual("joão");

                conn.Strings.Set(0, "idade", "27");
                conn.Strings.GetString(0, "idade").Result.ShouldEqual("27");
            }

            Debug.WriteLine("Fim");
        }
开发者ID:joaofx,项目名称:redisreplication,代码行数:33,代码来源:RedisTest.cs

示例13: should_result_in_field5_with_6

        public void should_result_in_field5_with_6()
        {
            using (var client = new RedisConnection("localhost"))
            {
                client.Open();

                var redis = new RedisBooksleeveConnector(client);

                var key = "hello";
                var field1 = "world";
                var field2 = "world2";
                var field3 = "w3";
                var field4 = "w4";
                var field5 = "w5";
                var field6 = "w6";

                redis.HSet(key, field1, "1");
                redis.HSet(key, field2, "2");
                redis.HSet(key, field3, "3");
                redis.HSet(key, field4, "4");
                redis.HSet(key, field5, "5");
                redis.HSet(key, field6, "6");

                var result = redis.HGetAll(key);
                Assert.That(result[field5], Is.EqualTo("5"));
            }
        }
开发者ID:scobrown,项目名称:Resque.RedisClient.Booksleeve,代码行数:27,代码来源:RedisClient.cs

示例14: CanNotOpenNonsenseConnection_DNS

 public void CanNotOpenNonsenseConnection_DNS()
 {
     using (var conn = new RedisConnection("doesnot.exist.ds.aasd981230d.com", 6500))
     {
         conn.Wait(conn.Open());
     }
 }
开发者ID:raycode,项目名称:booksleeve,代码行数:7,代码来源:Config.cs

示例15: CreateRedisConnection

        public Task<RedisConnection> CreateRedisConnection()
        {
            var settings = RedisConnectionProvider.Instance.ConnectionsSettings;
            var redisConnection = new RedisConnection(host: settings["host"], port: Convert.ToInt32(settings["port"]), password: settings["password"]);
            var taskCreateConnection = new TaskCompletionSource<RedisConnection>();

            try
            {
                redisConnection.Open().ContinueWith((task) =>
                    {
                        if (!task.IsFaulted)
                        {
                            taskCreateConnection.SetResult(redisConnection);
                        }
                        else
                        {
                            task.Exception.Handle(x => true);
                            taskCreateConnection.SetException(task.Exception);
                        }
                    }, TaskScheduler.Default);
            }
            catch (Exception ex)
            {
                taskCreateConnection.SetException(ex);
            }

            return taskCreateConnection.Task;
        }
开发者ID:g-un--,项目名称:log4net.redis,代码行数:28,代码来源:RedisConnectionFactory.cs


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