有时要为每一篇文章统计其点击次数,如果每一次浏览都要更新一次库的话,那性能在访问量很大的情况下,服务器的压力就会很大了,比较好一点的方法就是先将要更新的数据缓存起来,然后每隔一段时间再利用数据库的批量处理,批量更新库。源码如下: 7>3+]njw
Y?%=6S
CountBean.java F1/BtGvQE
|`d-;pk!%
/* 'M
fVZho{
* CountData.java \)cbg#v
* {6mFI1;q
* Created on 2007年1月1日, 下午4:44 >gDKkeLD
* j2oU1' b
* To change this template, choose Tools | Options and locate the template under ~BgNMO;|
* the Source Creation and Management node. Right-click the template and choose \^dYmU
* Open. You can then make changes to the template in the Source Editor. 0U!_ o2]
*/ TVK*l*
>0cg
package com.tot.count; ]Aj5 K
ITZ}$=
/** {5(M
* 1cV0TUrz
* @author Y]Zp[!
*/ UPkc-^BN
public class CountBean { |21*p#>
private String countType; sqO$ka{
int countId; ,vB nr_D#
/** Creates a new instance of CountData */ :M.]- +(
public CountBean() {} vV>=Uvm
public void setCountType(String countTypes){ I=;=;-
this.countType=countTypes; ufN`=IJ%
} x5k6"S"1,
public void setCountId(int countIds){ `82^!7 !
this.countId=countIds; "YN6o_*]
} SKo*8r
public String getCountType(){ o[g]Va*8
return countType; ue -a/a
} G*g*+D[HM
public int getCountId(){ WyUa3$[gO
return countId; &