有时要为每一篇文章统计其点击次数,如果每一次浏览都要更新一次库的话,那性能在访问量很大的情况下,服务器的压力就会很大了,比较好一点的方法就是先将要更新的数据缓存起来,然后每隔一段时间再利用数据库的批量处理,批量更新库。源码如下: w'UP#vT5&
NWKD:{
CountBean.java 4-m}W;igu
ddw!FH2W
(
/* !XK p_v
* CountData.java &oT]ycz%
* tvd/Y|bV=
* Created on 2007年1月1日, 下午4:44 )&*&ZL0
* FCg,p2
* To change this template, choose Tools | Options and locate the template under W7.]V)$wM
* the Source Creation and Management node. Right-click the template and choose aUd633
* Open. You can then make changes to the template in the Source Editor. sUg7
*/ 2hquE_1S[w
le*pd+> j
package com.tot.count; W] RxRdY6[
-q-%)f
/** k(T/ydrw
* Z
rvb
%
* @author P/^:IfuR
*/ ^D!UF(H
public class CountBean { akaQ6DIdG
private String countType; aa$+(
int countId; HbCM{A9
/** Creates a new instance of CountData */ r=s7be
public CountBean() {} Z{%h6""
public void setCountType(String countTypes){ |`,%%p|T%
this.countType=countTypes; f9;M"Pd
} A6-JV8^
public void setCountId(int countIds){ _v_ak4m>
this.countId=countIds; +|^rz#X
} ,UY],;ib
public String getCountType(){ ^G5_d"Gr
return countType; S]k<Ixvf
} ETYw
public int getCountId(){ O%rjY
return countId; *`|F?wF
} ).xQ~A\.
} v\Q${6kEtx
SC'fT!
CountCache.java 1;SWfKU?.
!sUo+Y
/* S_C+1e
* CountCache.java 94H 6`
* d'PjO-"g
* Created on 2007年1月1日, 下午5:01 + -U7ogs
* ^G=s<