SystemCache.cs 1.38 KB
using Hh.Mes.POJO.Entity;
using System.Collections.Generic;

namespace Hh.Mes.Pojo.System
{
    public class SystemCache
    {
        private static SystemCache _cache;
        private static readonly object LockHelper = new object();

        /// <summary> 内存缓存数据 SysModuleElement
        /// </summary>
        public List<SysModuleView> SysModuleViewCache;

        /// <summary> 内存缓存数据 SysModuleElement
        /// </summary>
        public List<SysModuleElement> SysModuleElementCache;

        private SystemCache()
        {
            SysModuleViewCache = new List<SysModuleView>(1);

            SysModuleElementCache = new List<SysModuleElement>(1);
        }

        public static SystemCache GetInstance
        {
            get
            {
                if (_cache == null)
                {
                    lock (LockHelper)
                    {
                        if (_cache == null)
                        {
                            _cache = new SystemCache();
                        }
                    }
                }
                return _cache;
            }
        }

        /// <summary>
        /// 清除缓存
        /// </summary>
        public void ClearSystemCache()
        {
            SysModuleViewCache = new List<SysModuleView>(1);

            SysModuleElementCache = new List<SysModuleElement>(1);

        }
    }
}