有时要为每一篇文章统计其点击次数,如果每一次浏览都要更新一次库的话,那性能在访问量很大的情况下,服务器的压力就会很大了,比较好一点的方法就是先将要更新的数据缓存起来,然后每隔一段时间再利用数据库的批量处理,批量更新库。源码如下: plq\D.C
.B*)A.
CountBean.java 3^Y-P8.zdB
ITV}f#
/* %y q}4[S+o
* CountData.java P$bo8*
* 5tL6R3
* Created on 2007年1月1日, 下午4:44 iu 'yB
* )r~Oj3TH
* To change this template, choose Tools | Options and locate the template under va0
a4s1O
* the Source Creation and Management node. Right-click the template and choose e+mD$(h
* Open. You can then make changes to the template in the Source Editor. K5$ y
*/ P_gQ-pF.
:vj buqN]
package com.tot.count; qA30G~S
1^COR+>L
/** OX"`VE
* ?S_S.Bd
* @author <bH>\@p7}
*/ wa C%o%fD
public class CountBean { f} apn=
private String countType; 1gC=xMAT
int countId; F2&KTK
/** Creates a new instance of CountData */ L`\ILJz
public CountBean() {} iAN#TCwLT7
public void setCountType(String countTypes){ o|+tRl
this.countType=countTypes; __QTlj
} &z