有时要为每一篇文章统计其点击次数,如果每一次浏览都要更新一次库的话,那性能在访问量很大的情况下,服务器的压力就会很大了,比较好一点的方法就是先将要更新的数据缓存起来,然后每隔一段时间再利用数据库的批量处理,批量更新库。源码如下: TEz)d=
jb1OcI%
CountBean.java *zeY<6
+*'
/* J XKps#,(#
* CountData.java _?>!Bz
m
* 4NN-'Z>a
* Created on 2007年1月1日, 下午4:44 ms'&.u&<
* =o\:@I[
* To change this template, choose Tools | Options and locate the template under u{0+w\xH\
* the Source Creation and Management node. Right-click the template and choose E{gu39 D
* Open. You can then make changes to the template in the Source Editor. y _J~n 9R
*/ *bRer[7y
!iUdej^tx
package com.tot.count; b9ysxuUdS
*}R5=r0
/** lnL&v'{
* 9qD/q?Hh$
* @author ~ z4T
*/ v:1l2Y)g
public class CountBean { mNN,}nHu
private String countType; ZiM#g1;
int countId; AE!WYE
/** Creates a new instance of CountData */ LinARMPv
public CountBean() {} PbxuD*LQ.
public void setCountType(String countTypes){ Pd!;z=I
this.countType=countTypes;
F7a &-
} C>7Mx{ !H
public void setCountId(int countIds){ fHvQ 9*T
this.countId=countIds; f/Km$#xOr
} jENarB^As
public String getCountType(){ cd{3JGgB
return countType; 8yz A
W&q
} GDw4=0u-
public int getCountId(){ )|,-l^lC
return countId; zYpIG8"o5
} o O%!P<