有时要为每一篇文章统计其点击次数,如果每一次浏览都要更新一次库的话,那性能在访问量很大的情况下,服务器的压力就会很大了,比较好一点的方法就是先将要更新的数据缓存起来,然后每隔一段时间再利用数据库的批量处理,批量更新库。源码如下: >/|q:b^2r
,VO2a mI
CountBean.java )1X#*mCxk
j?'GZ d"B
/* lg^Z*&(
* CountData.java $Xq!L
* ]+X@
7
* Created on 2007年1月1日, 下午4:44 *}P~P$q%
* x7O-Y~[2
* To change this template, choose Tools | Options and locate the template under eM8}X[
* the Source Creation and Management node. Right-click the template and choose %c4Hse#Y
* Open. You can then make changes to the template in the Source Editor. s{1sE)_
*/ HTG%t/S
:O uA)f
package com.tot.count; P&f7@MOV.P
'inFKy'H
/** a\r\PBi
* rW$[DdFA5{
* @author YPxM<Gfa8
*/ z<Nfm
public class CountBean { q<M2,YrbAI
private String countType; q.;u?,|E/
int countId; i{`:(F5*
/** Creates a new instance of CountData */ vam;4vyu
public CountBean() {} u A<n
public void setCountType(String countTypes){ OGl}-kw
this.countType=countTypes; %KLpig
} }~L.qG
public void setCountId(int countIds){ s%W C/ZK
this.countId=countIds; m^zUmrj[
} y+NN< EY@
public String getCountType(){ A6thXs2
return countType; tS6qWtE
} wfH^<jY)E
public int getCountId(){ -Fe?R*-g
return countId; #"G]ke1l$
} <