/// <summary>
        /// 添加试题集
        /// </summary>
        /// <param name="ques"></param>
        /// <param name="expires"></param>
        /// <returns>返回缓存的唯一标识</returns>
        public string Add(Questions[] ques, int expires)
        {
            QuestionsCache_Item qcitem = new QuestionsCache_Item(ques, expires);

            list.Add(qcitem);
            return(qcitem.UID);
        }
        /// <summary>
        /// 更新缓存
        /// </summary>
        /// <param name="ques">试题列表</param>
        /// <param name="expires"></param>
        /// <param name="uid"></param>
        public string Update(Questions[] ques, int expires, string uid)
        {
            QuestionsCache_Item qci = GetCache(uid);

            if (qci != null)
            {
                if (!string.IsNullOrWhiteSpace(uid))
                {
                    qci.UID = uid;
                }
                if (expires > 0)
                {
                    qci.Expires = expires;
                }
                if (ques != null)
                {
                    qci.Questions = ques.ToList <Questions>();
                }
            }
            else
            {
                qci     = new QuestionsCache_Item(ques, expires);
                qci.UID = uid;
                this.list.Add(qci);
            }
            return(qci.UID);
        }
        /// <summary>
        /// 添加试题集
        /// </summary>
        /// <param name="ques"></param>
        /// <param name="expires"></param>
        /// <returns>返回缓存的唯一标识</returns>
        public string Add(Questions[] ques, int expires, string uid)
        {
            QuestionsCache_Item qcitem = new QuestionsCache_Item();

            qcitem.Questions = ques.ToList <Questions>();
            qcitem.Expires   = expires;
            qcitem.UID       = uid;
            list.Add(qcitem);
            return(qcitem.UID);
        }
        /// <summary>
        /// 获取答题信息
        /// </summary>
        /// <param name="uid"></param>
        /// <returns></returns>
        public ExamResults GetExamResults(string uid)
        {
            QuestionsCache_Item qci = this.GetCache(uid);

            if (qci == null)
            {
                return(null);
            }
            return(qci.Result);
        }
        /// <summary>
        /// 获取缓存中的试题集
        /// </summary>
        /// <param name="uid"></param>
        /// <returns></returns>
        public List <Questions> GetQuestions(string uid)
        {
            QuestionsCache_Item qci = this.GetCache(uid);

            if (qci == null)
            {
                return(null);
            }
            return(qci.Questions);
        }
        /// <summary>
        /// 获取缓存对象
        /// </summary>
        /// <param name="uid">用于区分缓存对象的uid</param>
        /// <returns></returns>
        public QuestionsCache_Item GetCache(string uid)
        {
            //先取缓存试题集
            QuestionsCache_Item qci = null;

            for (int i = 0; i < list.Count; i++)
            {
                if (uid == list[i].UID)
                {
                    qci = list[i];
                    break;
                }
            }
            return(qci);
        }
        /// <summary>
        /// 获取缓存中的试题集
        /// </summary>
        /// <param name="uid"></param>
        /// <returns></returns>
        public List <Questions> GetQuestions(string uid)
        {
            QuestionsCache_Item qci = this.GetCache(uid);

            if (uid == "all")
            {
                if (qci == null)
                {
                    Song.Entities.Questions[] ques = Business.Do <IQuestions>().QuesCount(-1, null, -1);
                    this.Delete("all");
                    this.Add(ques, int.MaxValue, "all");
                }
                qci = this.GetCache(uid);
            }
            if (qci == null)
            {
                return(null);
            }
            return(qci.Questions);
        }
        /// <summary>
        /// 更新缓存
        /// </summary>
        /// <param name="exr">答题内容</param>
        /// <param name="expires"></param>
        /// <param name="uid"></param>
        /// <returns></returns>
        public string Update(ExamResults exr, int expires, string uid)
        {
            QuestionsCache_Item qci = GetCache(uid);

            if (qci != null)
            {
                if (!string.IsNullOrWhiteSpace(uid))
                {
                    qci.UID = uid;
                }
                if (expires > 0)
                {
                    qci.Expires = expires;
                }
                if (exr != null)
                {
                    qci.Result = exr;
                }
            }
            else
            {
                qci = new QuestionsCache_Item();
                if (expires > 0)
                {
                    qci.Expires = expires;
                }
                if (exr != null)
                {
                    qci.Result = exr;
                }
                qci.UID = uid;
                this.list.Add(qci);
            }
            //如果交卷
            if (exr.Exr_IsSubmit && !exr.Exr_IsCalc)
            {
                qci.Calculate();
            }
            return(qci.UID);
        }
        /// <summary>
        /// 添加试题集
        /// </summary>
        /// <param name="ques"></param>
        /// <param name="expires"></param>
        public void Add(List <Questions> ques, int expires)
        {
            QuestionsCache_Item qcitem = new QuestionsCache_Item(ques, expires);

            list.Add(qcitem);
        }