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));
|
|
}
|
|
}
|
}
|