有时要为每一篇文章统计其点击次数,如果每一次浏览都要更新一次库的话,那性能在访问量很大的情况下,服务器的压力就会很大了,比较好一点的方法就是先将要更新的数据缓存起来,然后每隔一段时间再利用数据库的批量处理,批量更新库。源码如下: -/.Xf<y58
lnFOD+y9
CountBean.java eswsxJ/!
Jn>7MuG
/* `!j|Ym
* CountData.java XACbDKyS
* <<da TQV
* Created on 2007年1月1日, 下午4:44 H3"[zg9L:a
* n#G
I& U
* To change this template, choose Tools | Options and locate the template under ^ )Lh5
* the Source Creation and Management node. Right-click the template and choose Xh/i5}5 t
* Open. You can then make changes to the template in the Source Editor. ,f4mFL0~N
*/ w`vJE!4B
iTt"Ik'
package com.tot.count; wR?M2*ri
-k
p~pe*T
/** [UVxtM J
* $C UmRi{T
* @author \:8 eN}B
*/ 9K@>{69WQ
public class CountBean { FBM 73D@`
private String countType; T{={uzQeJJ
int countId; \vB-0w
/** Creates a new instance of CountData */ Ey77]\
public CountBean() {} g<