有时要为每一篇文章统计其点击次数,如果每一次浏览都要更新一次库的话,那性能在访问量很大的情况下,服务器的压力就会很大了,比较好一点的方法就是先将要更新的数据缓存起来,然后每隔一段时间再利用数据库的批量处理,批量更新库。源码如下: Lq&xlW
j
/V*eAn8>
CountBean.java tIvtiN6[|l
7PvuKAv?k
/* [wOO)FjT
* CountData.java O>>8%=5Q
* yi%B5KF~Al
* Created on 2007年1月1日, 下午4:44 QWP_8$Q
* &`%C'KZ
* To change this template, choose Tools | Options and locate the template under 7v:;`6Jb
* the Source Creation and Management node. Right-click the template and choose PHOW,8)dZh
* Open. You can then make changes to the template in the Source Editor. WMC6dD_6e
*/ 4v?S`w:6
{l1;&y?
package com.tot.count; hmi15VW
``\H'^{B
/** 7:;V[/
* FJ[(dGKeE
* @author a[JgR /E@x
*/ P~*fZ)\}F@
public class CountBean { # \M<6n{
private String countType; EagI)W!s[
int countId; Fq3;7Cq=hD
/** Creates a new instance of CountData */ lk'RWy"pw
public CountBean() {} $H9xM
public void setCountType(String countTypes){ C/$IF M<
this.countType=countTypes; L@ay4,e.bz
} s-DtkO
public void setCountId(int countIds){ l;C_A;y\
this.countId=countIds; &S{F"z
} oc?VAF
public String getCountType(){ T<?;:MO88
return countType; D;E&;vP6%
} >9klh-f
public int getCountId(){ = G_6D
return countId; Q7s1M&K
} {%$=^XO
} =wQ=`
%SE g(<