當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。