有时要为每一篇文章统计其点击次数,如果每一次浏览都要更新一次库的话,那性能在访问量很大的情况下,服务器的压力就会很大了,比较好一点的方法就是先将要更新的数据缓存起来,然后每隔一段时间再利用数据库的批量处理,批量更新库。源码如下: cNHNh[ C
(Az^st/_
CountBean.java xKxWtZ0
tqHXzmsjW
/* niFjsTA.Z
* CountData.java 0Y\u,\GrxW
* .w0?
* Created on 2007年1月1日, 下午4:44 DQ,Q yV
* Y$N|p{Z
* To change this template, choose Tools | Options and locate the template under d{0>R{uac
* the Source Creation and Management node. Right-click the template and choose C'{Z?M>
* Open. You can then make changes to the template in the Source Editor. D%Wr/6X
*/ &Z9b&P
/HLQ
package com.tot.count; 7|2:;5:U
re<"%D
/** 9Y7 tI3
* +q3W t|
* @author ).-FuL4Y
*/ 0j3j/={|.1
public class CountBean { 7JujU.&{6
private String countType; /q]WV^H
int countId; f6DPah#
/** Creates a new instance of CountData */ ioZ2J"s
public CountBean() {} W?.Y%wc0
public void setCountType(String countTypes){ }JI5,d
this.countType=countTypes; LnBkd:>}
} p0-\G6
public void setCountId(int countIds){ qoEOM%dAqV
this.countId=countIds; (A1 !)c
} <{'':/tXI
public String getCountType(){
BYu|loc
return countType; e Q0bx&
} ?L_#AdK
public int getCountId(){ %bddR;c
return countId; &v