有时要为每一篇文章统计其点击次数,如果每一次浏览都要更新一次库的话,那性能在访问量很大的情况下,服务器的压力就会很大了,比较好一点的方法就是先将要更新的数据缓存起来,然后每隔一段时间再利用数据库的批量处理,批量更新库。源码如下: 3'?h;`v\Lo
HiQoRk
CountBean.java t-.2+6"\
*i=?0M4S
/* qk_p}l-F1
* CountData.java %GVEY
* +^/Nil
* Created on 2007年1月1日, 下午4:44 H.jLGe>
* [$hptQv
* To change this template, choose Tools | Options and locate the template under ~a|^?7@p
* the Source Creation and Management node. Right-click the template and choose f?/|;Zo4
* Open. You can then make changes to the template in the Source Editor. /Ki0+(4
*/ p2pTs&}S
mXxZM;P[
package com.tot.count; dNR7e
r24\DvS
/** se<i5JsSV
* =fKhXd
* @author `ENlV9
*/ UgF) J
public class CountBean { %Nwyx;>9^K
private String countType; )![f\!'PI
int countId; o 8~f
/** Creates a new instance of CountData */ XD_P\z
public CountBean() {} 7bgnZ]r8t
public void setCountType(String countTypes){ .Ws iOJU
this.countType=countTypes; &Iv\jhq
} ",MK'\E
public void setCountId(int countIds){ aX>4Tw
this.countId=countIds; xTa4.ZXg
} b5iIV1g
public String getCountType(){ hN>('S-cq
return countType; JxX
jDYrU
} o{ ,ba~$.w
public int getCountId(){ *Gk<"pEeS
return countId; M!xm1-,[
} (hhdbf
} 4FfwpO3,Ku
BxSk%$J
CountCache.java U6/m_`nc
u\Nw:Uu i
/* ?#VP)A
* CountCache.java N}8HK^n*
* [oQ`HX1g
* Created on 2007年1月1日, 下午5:01 e.3sAUHZ-
* 5~`|)~FA
* To change this template, choose Tools | Options and locate the template under IQ(]66c,
* the Source Creation and Management node. Right-click the template and choose (5f5P84x
* Open. You can then make changes to the template in the Source Editor. Q9Y9{T
*/ MFc=B`/X
!7O=<