예제 #1
0
파일: CacheFactory.cs 프로젝트: radtek/crm
        public static IJITCache2 CreateCache()
        {
            var    type = ConfigurationManager.AppSettings["CacheType"];
            string str  = ConfigurationManager.AppSettings["CacheServers"];

            string[] serverlist;
            if (string.IsNullOrEmpty(str))
            {
                serverlist = new string[] { };
            }
            else
            {
                serverlist = str.Split(',');
            }
            switch (type)
            {
            case "0":
                return(JITMemoryCache.GetInstance());

            case "1":
                return(JITDistributedCache.GetInstance(serverlist));

            default:
                return(JITMemoryCache.GetInstance());
            }
        }
예제 #2
0
 /// <summary>
 /// 返回单一实例
 /// </summary>
 /// <param name="pServerList"></param>
 /// <returns></returns>
 public static JITDistributedCache GetInstance(string[] pServerList)
 {
     if (_default != null)
     {
         return(_default);
     }
     else
     {
         return(_default = new JITDistributedCache(pServerList));
     }
 }