public ActionResult RedisServer_GetKeys() { //ViewBag.ServerName = ServerName; var redisServerModel = new RedisServerModel { Name = "Redis" }; //ConnectionMultiplexer con = ConnectionMultiplexer.Connect(GetRedisConfigurationString(ServerName)); //IDatabase cache = con.GetDatabase(); //ConnectionMultiplexer con = GetRedisConnectionMultiplexer(ServerName); IDatabase cache = CoreServices.RedisConnectionMultiplexers.RedisMultiplexer.GetDatabase(); var endpoints = CoreServices.RedisConnectionMultiplexers.RedisMultiplexer.GetEndPoints(true); var server = CoreServices.RedisConnectionMultiplexers.RedisMultiplexer.GetServer(endpoints[0]); foreach (RedisKey key in server.Keys(0)) { RedisType redisKeyType = cache.KeyType(key); if (redisKeyType.ToString().ToLower() == "string") { redisServerModel.StringKeys.Add(key); } else if (redisKeyType.ToString().ToLower() == "hash") { redisServerModel.HashKeys.Add(key); } } //con.Close(); return(View(redisServerModel)); }
public RedisProvider(RedisType redisType) { Conn = ConnectionMultiplexer.Connect(BaseCore.AppSetting.GetSection("RedisConfig").GetValue <string>(redisType.ToString())); RedisType = redisType; }