Пример #1
0
        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('"'));
        }
Пример #2
0
        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('"'));
        }