服务端的TigerApi 框架,基于.NET6 2024 版本
Rodney Chen
2024-10-17 b0bbf803a56ced1d89bd7c966686983259eae1e0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
using Rhea.Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Tiger.Business.DbCache;
using Tiger.IBusiness;
 
namespace Tiger.Business
{
    /// <summary>
    /// 监控总控
    /// </summary>
    public class DbCacheBus : IDbCacheBus
    {
        public static SysParamCache SysParamCache = new();
        //public static SysParamCacheOld SysParamCacheOld = new();
        public static CodeRuleCache CodeRuleCache = new();
        #region Functions
        public ISysParamCache GetSysParamCache() => SysParamCache;
        public ICodeRuleCache GetCodeRuleCache() => CodeRuleCache;
        public void StartAutoUpdate()
        {
            if (BizConfig.Configuration["IsUseDbCache"]?.ToLower() == "true")
            {
                //开启系统参数缓存
                SysParamCache.Start();
                //SysParamCacheOld.Start();
                ConsoleExt.WriteLine("Start SysParam Cache Auto Update Thread..........", ConsoleColor.Yellow);
                //开启系统参数缓存
                CodeRuleCache.Start();
                ConsoleExt.WriteLine("Start CodeRule Cache Auto Update Thread..........", ConsoleColor.Yellow);
            }
        }
 
        public void StopAutoUpdate()
        {
            if (BizConfig.Configuration["IsUseDbCache"]?.ToLower() == "true")
            {
                //关闭系统参数缓存
                SysParamCache.Stop();
                //SysParamCacheOld.Stop();
                //关闭系统参数缓存
                CodeRuleCache.Stop();
            }
        }
        #endregion
    }
}