예제 #1
0
 public IDatabase GetDatabase(string redisConnectionString = null, int db = 0, object asyncState = null)
 {
     if (string.IsNullOrWhiteSpace(redisConnectionString))
         throw new ArgumentNullException(redisConnectionString);
     var connect = DefaultRedisPersistentConnection.GetConnect(redisConnectionString);
     if (!connect.IsConnected())
     {
         connect = DefaultRedisPersistentConnection.TryConnect(redisConnectionString);
     }
     return connect.GetDatabase(db, asyncState);
 }
예제 #2
0
 public ISubscriber GetSubscriber(string redisConnectionString)
 {
     if (string.IsNullOrWhiteSpace(redisConnectionString))
         throw new ArgumentNullException(redisConnectionString);
     var connect = DefaultRedisPersistentConnection.GetConnect(redisConnectionString);
     if (!connect.IsConnected())
     {
         connect = DefaultRedisPersistentConnection.TryConnect(redisConnectionString);
     }
     return connect.GetSubscriber();
 }
예제 #3
0
        public async Task <ISubscriber> GetSubscriberAsync(string redisConnectionString)
        {
            if (string.IsNullOrWhiteSpace(redisConnectionString))
            {
                throw new ArgumentNullException(redisConnectionString);
            }
            var connect = await DefaultRedisPersistentConnection.GetConnectAsync(redisConnectionString);

            if (!connect.IsConnected())
            {
                connect = await DefaultRedisPersistentConnection.TryConnectAsync(redisConnectionString);
            }
            return(connect.GetSubscriber());
        }
예제 #4
0
        public async Task <IDatabase> GetDatabaseAsync(string redisConnectionString = null, int db = 0, object asyncState = null)
        {
            if (string.IsNullOrWhiteSpace(redisConnectionString))
            {
                throw new ArgumentNullException(redisConnectionString);
            }
            var connect = await DefaultRedisPersistentConnection.GetConnectAsync(redisConnectionString);

            if (!connect.IsConnected())
            {
                connect = await DefaultRedisPersistentConnection.TryConnectAsync(redisConnectionString);
            }
            return(connect.GetDatabase(db, asyncState));
        }
예제 #5
0
 public void Dispose()
 {
     DefaultRedisPersistentConnection.Dispose();
 }