示例#1
0
        /// <summary>
        /// 缓存维护参数配置信息
        /// </summary>
        void ShowCacheMaintainConfig()
        {
            StringBuilder sb = new StringBuilder();

            if (null != Startup.CacheMaintainConfigs && Startup.CacheMaintainConfigs.Count > 0)
            {
                sb.AppendLine("缓存维护参数配置:");

                string server    = null;
                Regex  regServer = new Regex(@"(?<server>[0-9a-z\-]+(\.[0-9a-z\-]+)+)", RegexOptions.IgnoreCase);
                var    dcoll     = regServer.Match(Startup.DataCacheRedisConnectionString);
                if (null != dcoll)
                {
                    server = dcoll.Groups["server"].Value;
                }

                sb.AppendLine(string.Format(@"   缓存Redis服务器:{0}", server));

                foreach (var config in Startup.CacheMaintainConfigs)
                {
                    string levelDesc = "";

                    switch (config.Level)
                    {
                    case CacheLevel.Hight: levelDesc = "高"; break;

                    case CacheLevel.Lower: levelDesc = "低"; break;

                    case CacheLevel.Middel: levelDesc = "中等"; break;

                    case CacheLevel.Permanent: levelDesc = "持久"; break;
                    }

                    string option = SysData.GetCacheTimeOptionName(config.TimeOption.ToString());

                    sb.AppendLine(string.Format("   {0}级别的缓存更新周期为 {1} {2}", levelDesc, config.PeriodTime, option));
                }
            }

            WriteOutConfig(sb.ToString(), true);
        }