有时要为每一篇文章统计其点击次数,如果每一次浏览都要更新一次库的话,那性能在访问量很大的情况下,服务器的压力就会很大了,比较好一点的方法就是先将要更新的数据缓存起来,然后每隔一段时间再利用数据库的批量处理,批量更新库。源码如下: ^GrNfB[Qu
Ja^7$WY
CountBean.java !'Gb$l!
ZWov_
/* ^Kb9@lz/
* CountData.java _T_PX$B
* fp,1qzU[k
* Created on 2007年1月1日, 下午4:44 [f/vLLK
* w/hh
4ir
* To change this template, choose Tools | Options and locate the template under 6vMDm0sv
* the Source Creation and Management node. Right-click the template and choose Z3Bo@`&?
* Open. You can then make changes to the template in the Source Editor. (/To?`
*/ t*eleNYeS~
O7! fI'R
package com.tot.count; =%:JjgKc*t
$,p.=j;P
/** >N :|Km\
* \,$r,6-g
* @author ;jp6 }zfI
*/ R (t!xf
public class CountBean { yp( ?1
private String countType; b/T20F{W\o
int countId; XCKY
xv&
/** Creates a new instance of CountData */ cw*(L5bu
public CountBean() {} *pDXcURw
public void setCountType(String countTypes){ cr2{sGn|
this.countType=countTypes; )i},@T8[
} f_^ix
public void setCountId(int countIds){ !pG+Ak?
this.countId=countIds; 2O}s*C$Xav
} v+|@}9| Z
public String getCountType(){ |`N$>9qN
return countType; ?v0A/68s#
} %ZJ),9+
public int getCountId(){ ';i"?D?NAk
return countId; 2<p5_4"-U*
} FSI]k:
} ^yzo!`)fso
<