cacheVisit cv=new cacheVisit();
cv.sysno=sysno;
cv.reurl=reurl;
cv.ip=GetIpV4AndV6();
cv.moduleclass=moduleclass;
if (Cache["YddVisit"] == null)
{
List<cacheVisit> cvs = new List<cacheVisit>();
cvs.Add(cv);
Cache.Insert("YddVisit", cvs);
}
else
{
List<cacheVisit> cvs = (List<cacheVisit>)Cache["YddVisit"];
if (cvs.Count < 10)
{
cvs.Add(cv);
Cache.Insert("YddVisit", cvs);
}
else
{
List<cacheVisit> cvs2 = (List<cacheVisit>)Cache["YddVisit"];
foreach (cacheVisit cvf in cvs2)
{
if (cvf.reurl == "")
EC.Biz.ICBC.ICBC_Product_DailyClickManager.GetInstance().Add(cvf.sysno, "", cvf.ip, cvf.moduleclass);
else
EC.Biz.ICBC.ICBC_Product_DailyClickManager.GetInstance().Add(cvf.sysno, cvf.reurl, cvf.ip, cvf.moduleclass);
}
Cache.Remove("YddVisit");
}
}
每当有10条时统一更新到数据库,实际应该是拼SQL一次执行比较好些!
转载于:https://www.cnblogs.com/assion/archive/2009/05/10/1453613.html