有时要为每一篇文章统计其点击次数,如果每一次浏览都要更新一次库的话,那性能在访问量很大的情况下,服务器的压力就会很大了,比较好一点的方法就是先将要更新的数据缓存起来,然后每隔一段时间再利用数据库的批量处理,批量更新库。源码如下: ] G.%Ty
"@@I!RwA
CountBean.java [97:4.
+[@z(N-h
/* j| Wv7
* CountData.java A,CW_
* 8*SDiZ
* Created on 2007年1月1日, 下午4:44 'crlA~/
* zepop19
* To change this template, choose Tools | Options and locate the template under :a8 YV!X
* the Source Creation and Management node. Right-click the template and choose w&$d* E
* Open. You can then make changes to the template in the Source Editor. #&<)! YY5
*/ y4Z&@,_{
$CTSnlPq
package com.tot.count; *b *G2f^
682Z}"I0
/** eg<bi@C1|
* \}6;Kf}\
* @author %98' @$:0
*/ &wd;EGGT!q
public class CountBean { "q}FPJ^l_N
private String countType; bawJ$_O_
int countId; "xcX'F^
/** Creates a new instance of CountData */
N#V.1<Y
public CountBean() {} m^' uipa\
public void setCountType(String countTypes){ lN,/3\B
this.countType=countTypes; H|ozDA
} rrg96WD
public void setCountId(int countIds){ $p!yhn7
this.countId=countIds; }7fZ[J3
} '[$)bPMHl
public String getCountType(){ 7*j
(*
return countType; eD$M<Eu
} "gd=J_Yw
public int getCountId(){ ^Jb
H?
return countId; HS'Vi9
} Er/bO
} Ze<K=Q%(i
UT~a&u
CountCache.java `k(yZtb
@3fn)YQ'
/* NC&DF