有时要为每一篇文章统计其点击次数,如果每一次浏览都要更新一次库的话,那性能在访问量很大的情况下,服务器的压力就会很大了,比较好一点的方法就是先将要更新的数据缓存起来,然后每隔一段时间再利用数据库的批量处理,批量更新库。源码如下: 317Lv
\[
T?W`g>yM
CountBean.java 3tMFJ ;*`
@x">e][B
/* KaC+x-%K
* CountData.java U}7a;4?
* }O<u
* Created on 2007年1月1日, 下午4:44 V.kUFTCvf
* ![Z'jCpy
* To change this template, choose Tools | Options and locate the template under x68$?CD
* the Source Creation and Management node. Right-click the template and choose sm-RpZ&|
* Open. You can then make changes to the template in the Source Editor. "Y9
*rL
*/ d-g&TSGd
2H8,&lY.p
package com.tot.count; xX`P-h>V`c
X8Px
/** =&~*r
* i~}[/^
* @author qG=9zp4y?Y
*/ xI}h{AF7
public class CountBean { n%I%O7
private String countType; i{w<4E3
int countId; ,~t{Q*#_h
/** Creates a new instance of CountData */ fr8:L!9
public CountBean() {} MoN;t;
public void setCountType(String countTypes){ 4"fiEt,t<x
this.countType=countTypes; D}l^ow
} 89:Y s=
public void setCountId(int countIds){ ;2
oR?COW
this.countId=countIds; NaC^q*>9
} Wa%Zt*7
public String getCountType(){ m/sAYF"
return countType; <4,>`#NEo
} XCO{}wU)>
public int getCountId(){ L2[|g~
return countId; oJw~g[
} w?A&X