有时要为每一篇文章统计其点击次数,如果每一次浏览都要更新一次库的话,那性能在访问量很大的情况下,服务器的压力就会很大了,比较好一点的方法就是先将要更新的数据缓存起来,然后每隔一段时间再利用数据库的批量处理,批量更新库。源码如下: dj2w_:&W
:zp9L/eh
CountBean.java :3A^5}iz
k<A|+![
/* moCr4*jDX,
* CountData.java 6(8zt"E
* ZO8r8
[
* Created on 2007年1月1日, 下午4:44 ["0DXm%t
* iT=h}>
* To change this template, choose Tools | Options and locate the template under B+4WnR1%T
* the Source Creation and Management node. Right-click the template and choose RXw }Tb/D8
* Open. You can then make changes to the template in the Source Editor. &|I{ju_
*/ -58Sb"f
S5/p3;O\c
package com.tot.count; qlm7eS"sy
o7kQ&w
/** oCSJ<+[(C
* &6&$vF65c
* @author N~vK8j@
*/ OICH:(t_
public class CountBean { MmH(dp+
private String countType; 63HtZ=hO7
int countId; r*f:%epB%
/** Creates a new instance of CountData */ [vn"r^P
public CountBean() {} WXFCe@
public void setCountType(String countTypes){ 3eN(Sw@p
this.countType=countTypes; 4Ul*`/d
} ~tZy-1
public void setCountId(int countIds){ hh8U/dVk*
this.countId=countIds; Q5 =
} F@<^
public String getCountType(){ "sJ@_lp
return countType; }e-D&