有时要为每一篇文章统计其点击次数,如果每一次浏览都要更新一次库的话,那性能在访问量很大的情况下,服务器的压力就会很大了,比较好一点的方法就是先将要更新的数据缓存起来,然后每隔一段时间再利用数据库的批量处理,批量更新库。源码如下: k e
sg ]K
*,:>EcDr
CountBean.java I0
78[3b
CHeU?NtFps
/* Nm.H
* CountData.java c&{1Z&Y
* S4m??B
* Created on 2007年1月1日, 下午4:44 !y&uK&1
* \{HbL,s
* To change this template, choose Tools | Options and locate the template under H6Mqy}4W
* the Source Creation and Management node. Right-click the template and choose b1(7<o
* Open. You can then make changes to the template in the Source Editor. ]ZD W+<
*/ "%o,P/<X
4$);x/
a
package com.tot.count; WUwH W
KxZO.>,
/** O T*C7=
* 2qw -:
* @author b) k\?'j
*/ TSGJ2u5ie%
public class CountBean { u?(@hUV.
private String countType; >tUi ;!cQ
int countId; .^aakM
/** Creates a new instance of CountData */ Rqi=AQ
public CountBean() {} gn2*'_V~3
public void setCountType(String countTypes){ $>PXX32
this.countType=countTypes; SXYH#p
} KT 3W>/#E
public void setCountId(int countIds){ >UUcKq1M:
this.countId=countIds; 5`TbM
} DChqcdx~~
public String getCountType(){ JHxy_<p/
return countType; ~$I9%z7@
} y9K U&