有时要为每一篇文章统计其点击次数,如果每一次浏览都要更新一次库的话,那性能在访问量很大的情况下,服务器的压力就会很大了,比较好一点的方法就是先将要更新的数据缓存起来,然后每隔一段时间再利用数据库的批量处理,批量更新库。源码如下: ~3bH2,{L[
*;@V5[^3I?
CountBean.java $L%gQkz_
t1"-3afe
/*
cc`+rD5I-
* CountData.java +LFh}-X{_
* NrA?^F
* Created on 2007年1月1日, 下午4:44 zV {_dO
* 'qel3Fs"
* To change this template, choose Tools | Options and locate the template under t M?3oO
* the Source Creation and Management node. Right-click the template and choose :j feY
* Open. You can then make changes to the template in the Source Editor. _]zm02|
*/ z0|%h?N
*%'nlAX6%
package com.tot.count; KYBoGCS >
FbO\ #p s
/** h[HFZv~{
* ?=$=c8xw
* @author q$IgkL
*/ Jd#g"a>zZ
public class CountBean { zv/owK
private String countType; Y,0D+sO4
int countId; K@d, 8 [
/** Creates a new instance of CountData */ %Y!31oC#
public CountBean() {} |hGi8
public void setCountType(String countTypes){ kD1[6cJ!=.
this.countType=countTypes; +9Vp<(
} )~@iM.}S2
public void setCountId(int countIds){ LWwWxerZ
this.countId=countIds; X|]&K
} {Aq2}sRl{
public String getCountType(){ ))Q3;mI"
return countType; K`%{(^}.
} C.su<B?
public int getCountId(){ ,Hq*zc c
return countId; cvSr><(
} O$SQzLZx&
} (rF XzCI
`wrN$&
CountCache.java +2Xq+P
wP-BaB$_
/* 8/4i7oOC
* CountCache.java i_<