有时要为每一篇文章统计其点击次数,如果每一次浏览都要更新一次库的话,那性能在访问量很大的情况下,服务器的压力就会很大了,比较好一点的方法就是先将要更新的数据缓存起来,然后每隔一段时间再利用数据库的批量处理,批量更新库。源码如下: B_6v'=7]
}r\SP3
CountBean.java 5Rt0h$_J
6H . L!tUI
/* "m\UqQGX
* CountData.java *RqO3=
* /ltP@*bo
* Created on 2007年1月1日, 下午4:44 u"CIPc{Sr
* QL|:(QM
* To change this template, choose Tools | Options and locate the template under =QO1FO
* the Source Creation and Management node. Right-click the template and choose Rqd %#v
* Open. You can then make changes to the template in the Source Editor. n?KS]ar>
*/
xaq=?3QOH
j)SgB7Q
package com.tot.count; n?ZH2dI\0
;zxlwdfcr'
/** j#.-MfB
* emDvy2uA#
* @author f%"_U'
*/ %<#$:Qb.
public class CountBean { 0e5-\a
private String countType; * y"GgI
int countId; 9"u@<]
/** Creates a new instance of CountData */ K]=>F
public CountBean() {} m@
'I|!^
public void setCountType(String countTypes){ y^+[eT&