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


C# ConnectionMultiplexer.GetEndPoints方法代码示例

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


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

示例1: RedisAdaptor

        public RedisAdaptor(List<EndPoint> endPoints)
        {
            var config = new ConfigurationOptions()
            {
                AllowAdmin = true,
            };

            foreach (var endPoint in endPoints)
            {
                config.EndPoints.Add(endPoint);
            }

            muxerInstance = ConnectionMultiplexer.Connect(config);

            Handle = muxerInstance.GetDatabase();

            var script = Load("update_multikeys_multifields.lua");

            //todo a hack way .. to be changed later
            foreach (var endPoint in muxerInstance.GetEndPoints())
            {
                var server = muxerInstance.GetServer(endPoint);

                updateScriptSha = server.ScriptLoad(script);
            }

            Handle.StringSet("test", "111");
        }
开发者ID:fingerpasswang,项目名称:Phial,代码行数:28,代码来源:RedisAdaptor.cs

示例2: RedisStorage

        public RedisStorage(string connectionString, RedisStorageOptions options = null)
        {
            if (connectionString == null) throw new ArgumentNullException("connectionString");
            if (options == null) options = new RedisStorageOptions();

            _connectionMultiplexer = ConnectionMultiplexer.Connect(connectionString);
            _invisibilityTimeout = options.InvisibilityTimeout;
            var endpoint = _connectionMultiplexer.GetEndPoints()[0];
            if (endpoint is IPEndPoint)
            {
                var ipEp = endpoint as IPEndPoint;
                ConnectionString = string.Format("{0}:{1}", TryGetHostName(ipEp.Address), ipEp.Port);
            }
            else
            {
                var dnsEp = endpoint as DnsEndPoint;
                ConnectionString = string.Format("{0}:{1}", dnsEp.Host, dnsEp.Port);
            }

            Db = options.Db;
            if (Prefix != options.Prefix)
            {
                Prefix = options.Prefix;
            }
            identity = Guid.NewGuid().ToString();
        }
开发者ID:xyting,项目名称:Hangfire.Redis.StackExchange,代码行数:26,代码来源:RedisStorage.cs

示例3: RedisStorage

		public RedisStorage(string connectionString, int db, TimeSpan invisibilityTimeout)
		{
			if (connectionString == null) throw new ArgumentNullException("connectionString");
			if (invisibilityTimeout == null) throw new ArgumentNullException("invisibilityTimeout");

			_connectionMultiplexer = ConnectionMultiplexer.Connect(connectionString);
			_invisibilityTimeout = invisibilityTimeout;
			var endpoint = _connectionMultiplexer.GetEndPoints()[0];
			if (endpoint is IPEndPoint)
			{
				var ipEp = endpoint as IPEndPoint;
				ConnectionString = string.Format("{0}:{1}", TryGetHostName(ipEp.Address), ipEp.Port);
			}
			else 
			{
				var dnsEp = endpoint as DnsEndPoint;
				ConnectionString = string.Format("{0}:{1}", dnsEp.Host, dnsEp.Port);
			}
			
			Db = db;

		}
开发者ID:IntranetFactory,项目名称:Hangfire.Redis.StackExchange,代码行数:22,代码来源:RedisStorage.cs

示例4: TryGetServer

        internal static IServer TryGetServer(ConnectionMultiplexer muxer, bool checkConnected = true)
        {
            if (muxer != null)
            {
                var eps = muxer.GetEndPoints(true);
                foreach (var ep in eps)
                {
                    var server = muxer.GetServer(ep);
                    if (server.IsSlave) continue;
                    if (checkConnected && !server.IsConnected) continue;

                    // that'll do
                    return server;
                }
            }
            return null;
        }
开发者ID:kpitt,项目名称:RyuJIT-TailCallBug,代码行数:17,代码来源:AsyncRedisConnection.cs

示例5: GetHost

		internal static string GetHost(ConnectionMultiplexer cache)
		{
			var endPoint = cache.GetEndPoints()[0];

			var dnsEndPoint = endPoint as DnsEndPoint;

			if (dnsEndPoint != null)
			{
				return String.Format("{0}:{1}", dnsEndPoint.Host, dnsEndPoint.Port);
			}

			var ipEndPoint = endPoint as IPEndPoint;

			if (ipEndPoint != null)
			{
				return String.Format("{0}:{1}", ipEndPoint.Address, ipEndPoint.Port);
			}

			return endPoint.ToString();
		}
开发者ID:rosslynquynhnguyen,项目名称:RedLock.net,代码行数:20,代码来源:RedisLock.cs

示例6: GetServer

 internal static IServer GetServer(ConnectionMultiplexer conn)
 {
     return conn.GetServer(conn.GetEndPoints()[0]);
 }
开发者ID:dedalebeda,项目名称:StackExchange.Redis,代码行数:4,代码来源:Config.cs

示例7: FlushDatabase

 /// <summary>
 /// Flushes the database that the connection belongs to.
 /// </summary>
 /// <param name="connection">
 /// The connection.
 /// </param>
 public void FlushDatabase(ConnectionMultiplexer connection)
 {
     EndPoint[] endPoints = connection.GetEndPoints();
     foreach (var endPoint in endPoints)
     {
         connection.GetServer(endPoint).FlushDatabase(this.Db);
     }
 }
开发者ID:JesseBuesking,项目名称:BB.Caching,代码行数:14,代码来源:SharedCache.cs

示例8: SetUp

 public void SetUp()
 {
     redis = ConnectionMultiplexer.Connect("localhost,resolvedns=1,allowadmin=1,connectTimeout=10000");
     endpoint = redis.GetEndPoints().First();
 }
开发者ID:wallymathieu,项目名称:redis-studies,代码行数:5,代码来源:PersistingEventsTests.cs


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