using iWareCommon.Common.Entity;
using iWareExcel.EXCEL.Entity;
using iWareExcel.EXCEL.Service;
using iWareWms.Code.Common.Entity;
using System.Collections.Generic;
namespace iWareWms.Code.Common.Service
{
    public class CacheService
    {
        private static object Lock = new object();
         private CacheService() { }
         private static CacheService Instance = null;
        /// 
        /// 获取单例的方法
        /// 
         /// 缓存服务的单例实体
         public static CacheService GetInstance()
         {
             if (Instance == null)
             {
                 lock (Lock)
                 {
                     if (Instance == null)
                     {
                         Instance = new CacheService();
                     }
                 }
             }
             return Instance;
         }
        /// 
        /// 更新缓存
        /// 
        /// 
        public void RefreshCache(out string msg)
        {
            CacheEntity.WorkBookDict = new Dictionary();
            var workBooks = WorkBookService.GetInstance().QueryByParam(new QueryParam(), out msg);
            workBooks.ForEach(x => CacheEntity.WorkBookDict.Add(x.Name, x));
           
        }
    }
}