public static string GetValueOrDefault(string key, string defaultValue) { string value = RedisUtil.Get <string>("WebConfig_" + key); if (string.IsNullOrWhiteSpace(value)) { WebConfig model = SingleModel.GetModel("WebKey='" + key + "'"); if (model == null) { value = defaultValue; } else { value = model.WebValue; } RedisUtil.Set <string>("WebConfig_" + key, value); } return(value.Trim('"')); }
public static string GetValue(string key) { string value = RedisUtil.Get <string>("WebConfig_" + key); if (string.IsNullOrEmpty(value)) { WebConfig model = SingleModel.GetModel("WebKey='" + key + "'"); if (model == null) { value = string.Empty; } else { value = model.WebValue; } RedisUtil.Set <string>("WebConfig_" + key, value); } return(value.Trim('"')); }