有时要为每一篇文章统计其点击次数,如果每一次浏览都要更新一次库的话,那性能在访问量很大的情况下,服务器的压力就会很大了,比较好一点的方法就是先将要更新的数据缓存起来,然后每隔一段时间再利用数据库的批量处理,批量更新库。源码如下: :EH=_"
M;NX:mX9
CountBean.java 6RM/GM
Ie^l~Gb
/* 9kojLqCT
* CountData.java 7KPwQ?SjT
* 3F0 N^)@
* Created on 2007年1月1日, 下午4:44 &{RDM~
* G
j1_!.T
* To change this template, choose Tools | Options and locate the template under ;]fs'LH
* the Source Creation and Management node. Right-click the template and choose OTp]Xe/
* Open. You can then make changes to the template in the Source Editor.
Y~Ifj,\
*/ IAEAhqp
nie% eC&U
package com.tot.count; 2(nlJ7R
:!/8Hv
/** bfO=;S]b!
* `kr?j:g
* @author a>)f=uS
*/ w:l"\Tm
public class CountBean { W`&hp6Jq
private String countType; W l16`9
int countId; -DCbko
/** Creates a new instance of CountData */ yBRC*0+Vy
public CountBean() {} {|\.i
public void setCountType(String countTypes){ 8] ikygt"
this.countType=countTypes; KF/-wZ"1s
} fQ98(+6
public void setCountId(int countIds){ Th[dW<