예제 #1
0
        public void AddProcessCache()
        {
            var watch             = Stopwatch.StartNew();
            int userId            = 1157;
            int questIdx          = 345;
            var questProcessCache = new ShareCacheStruct <QuestProcess>();

            var  list   = new List <QuestProcess>();
            int  repNum = 0;
            long no     = questProcessCache.GetNextNo(true);

            Trace.WriteLine("running time:" + watch.ElapsedMilliseconds);
            uint count = 20000;

            for (int i = 0; i < count; i++)
            {
                QuestProcess qProcess = new QuestProcess();
                qProcess.Suoyin       = Convert.ToInt32(no);
                qProcess.Character    = userId;
                qProcess.QuestIndex   = questIdx;
                qProcess.RegisterDate = DateTime.Now;

                if (qProcess.Suoyin >= 10000 && qProcess.Suoyin < 10001)
                {
                    Trace.WriteLine("GetNextNo:" + no);
                    Trace.WriteLine("json:" + JsonUtils.SerializeCustom(qProcess));
                    repNum++;
                }
                list.Add(qProcess);
                no++;
            }
            questProcessCache.SetNoAddCount(count);
            Trace.WriteLine("running time:" + watch.ElapsedMilliseconds);
            Assert.IsTrue(questProcessCache.AddRange(list));
            WaitEnd(watch);
            //Assert.IsTrue(repNum > 1);
        }