标签: redis servicestack servicestack.redis
我想知道给定一个任意连接字符串,如何测试是否建立了与Redis服务器的连接。谢谢!
答案 0 :(得分:2)
只需在像PING这样的新客户端中运行命令,例如:
try { using (var redis = new RedisClient(connectionString)) { var connected = redis.Ping(); } } catch (Exception ex) { //connection failed }