有时要为每一篇文章统计其点击次数,如果每一次浏览都要更新一次库的话,那性能在访问量很大的情况下,服务器的压力就会很大了,比较好一点的方法就是先将要更新的数据缓存起来,然后每隔一段时间再利用数据库的批量处理,批量更新库。源码如下: \` w4|T
zW8*E E+,
CountBean.java jp+_@S>
J/6`oh?,Q
/* S:61vD
* CountData.java {ccIxL
/~
* ;;)`c/$
* Created on 2007年1月1日, 下午4:44 wdvLx
* s[Ur~Wvn
* To change this template, choose Tools | Options and locate the template under 6yy;JQAke
* the Source Creation and Management node. Right-click the template and choose Yh)Isg|0>
* Open. You can then make changes to the template in the Source Editor. {w
<+_++
*/ CD0VfA>Z
.O0O-VD+a
package com.tot.count; vOgC>_x7
/1`cRyS
/** z* <y5
* yE} dj)wd
* @author Hk7K`9
*/ ]Zf6Yw .Y
public class CountBean { KL'zXkS
private String countType; [ REf>_R
int countId; 8I,QD`
xu
/** Creates a new instance of CountData */ F%rHU5CkV
public CountBean() {} G9g6.8*&
public void setCountType(String countTypes){ ^ZTGJ(j7~
this.countType=countTypes; 0qFH
s
} De_ CF8
public void setCountId(int countIds){ ,DnYtIERo
this.countId=countIds; )$Z(|M4
} l|V;Ys5f
public String getCountType(){ ~svO*o Wa
return countType; +2C?9:bH
} H0"= Vs,n
public int getCountId(){ V84*0&q