2

I would like to know given an arbitrary connection string, how do I test if the connection to a Redis Server is established. Thanks!

icube
  • 2,578
  • 1
  • 30
  • 63

1 Answers1

2

Just run a command in a new client like PING, e.g:

try
{
    using (var redis = new RedisClient(connectionString))
    {
        var connected = redis.Ping();
    }
} 
catch (Exception ex) 
{
    //connection failed
}
mythz
  • 141,670
  • 29
  • 246
  • 390