有时要为每一篇文章统计其点击次数,如果每一次浏览都要更新一次库的话,那性能在访问量很大的情况下,服务器的压力就会很大了,比较好一点的方法就是先将要更新的数据缓存起来,然后每隔一段时间再利用数据库的批量处理,批量更新库。源码如下: `< xn8h9p
nlW +.a[
CountBean.java ;[M}MFc/`
9f&C
/* ]sE?ezu
* CountData.java z([ v%zf
* 7f0lQ
* Created on 2007年1月1日, 下午4:44 K`u(/kz/<
* `HZ;NRr
* To change this template, choose Tools | Options and locate the template under |}(`kW
* the Source Creation and Management node. Right-click the template and choose FaDjLo2'o
* Open. You can then make changes to the template in the Source Editor. mP0yk|
*/ m^ tFi7c
y:~ZLTAv
package com.tot.count; C|}iCB
-"=U?>(
/** `f*Q$Ulqx
* #a'Ex=%rM
* @author v(ZYS']d2
*/ tjdaaN#,V
public class CountBean { $W!!wN=B
private String countType; kBD>-5Sn_T
int countId; $5ak_@AC
/** Creates a new instance of CountData */ P)Rh=U
public CountBean() {} j g8fU
public void setCountType(String countTypes){ 57umx`m
this.countType=countTypes; jRJn+
} 0n;<
ge&~R
public void setCountId(int countIds){ ;" dV"W
this.countId=countIds; ]G5w6&d
}
h*w%jdQ6
public String getCountType(){ !4XOy B
return countType; =kJ,%\E`
} :,'wVS8"]
public int getCountId(){ !cO]<