Example #1
0
        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());
            }
        }
Example #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));
     }
 }