有时要为每一篇文章统计其点击次数,如果每一次浏览都要更新一次库的话,那性能在访问量很大的情况下,服务器的压力就会很大了,比较好一点的方法就是先将要更新的数据缓存起来,然后每隔一段时间再利用数据库的批量处理,批量更新库。源码如下: ZY*_x)h+#7
"10.,QK
CountBean.java ^K0oJg.E
OjsMT]
/* y*T@_on5
* CountData.java 8qwPk4
* wit
* Created on 2007年1月1日, 下午4:44 glZjo
* ld7B{ ?]
* To change this template, choose Tools | Options and locate the template under kiu#THF
* the Source Creation and Management node. Right-click the template and choose ^zKP5nzL
* Open. You can then make changes to the template in the Source Editor. UcWf
O!}D
*/ ^&\<[\
m%U$37A1
package com.tot.count; y4,t=Gq7^
=U}!+ 8f
/** ;!B>b)%
* 2#@-t{\3-p
* @author ~j[mM E}
*/ /! M%9gu
public class CountBean { uOJso2Mx
private String countType; i2?TMM!Fe
int countId; $d
Nmq
/** Creates a new instance of CountData */ }b+$S'`Bv
public CountBean() {} ggUw4w/e
public void setCountType(String countTypes){ K_-S`-eH
this.countType=countTypes; dG)}H_
} H,;9' *84
public void setCountId(int countIds){ , RU
this.countId=countIds; ,"Nb;Yhg
} wLKC6@
W
public String getCountType(){ 3 +8{Y
return countType; ?'U@oz8 B
} t:%u4\nZ;
public int getCountId(){ dC?l%,W
return countId; 9PG3cCr?
} (t"e#b(:
} f<vZ4 IU
:8Ugz ~i
CountCache.java ?tkd5kE
t8uaNvUM}e
/* vs{xr*Ft
* CountCache.java F@1Eg
* ?:Rw[T@
l
* Created on 2007年1月1日, 下午5:01 M-A{{q
* QURpg/<U
* To change this template, choose Tools | Options and locate the template under 9j<