2
schangxiang@126.com
2024-08-16 b47c50a2a514def7374b32d7194b2c599cba5625
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
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;
 
        /// <summary>
        /// 获取单例的方法
        /// </summary>
         /// <returns>缓存服务的单例实体</returns>
         public static CacheService GetInstance()
         {
 
             if (Instance == null)
             {
                 lock (Lock)
                 {
                     if (Instance == null)
                     {
                         Instance = new CacheService();
                     }
                 }
             }
             return Instance;
         }
 
 
        /// <summary>
        /// 更新缓存
        /// </summary>
        /// <param name="msg"></param>
        public void RefreshCache(out string msg)
        {
            CacheEntity.WorkBookDict = new Dictionary<string, WorkBookEntity>();
            var workBooks = WorkBookService.GetInstance().QueryByParam(new QueryParam(), out msg);
            workBooks.ForEach(x => CacheEntity.WorkBookDict.Add(x.Name, x));
           
        }
 
    }
}