有时要为每一篇文章统计其点击次数,如果每一次浏览都要更新一次库的话,那性能在访问量很大的情况下,服务器的压力就会很大了,比较好一点的方法就是先将要更新的数据缓存起来,然后每隔一段时间再利用数据库的批量处理,批量更新库。源码如下: &nkW1Ner9
~ !
3I2
CountBean.java Vf'd*-_!Q<
IOoz^/'
/* a1.Ptf eW|
* CountData.java _$f9]bab
* ]*FVz$>XM
* Created on 2007年1月1日, 下午4:44 vj\d A2!~
* U{z9>
* To change this template, choose Tools | Options and locate the template under PBxCx3a{
* the Source Creation and Management node. Right-click the template and choose X4t s)>"d
* Open. You can then make changes to the template in the Source Editor. ;A'Z4=*~
*/ 7J|VD#DE$Y
0-|byAh
package com.tot.count; 2Sp=rI
!{)tSipd
/** Y&_&s7z
* NqEA4C
* @author dBe`p5Z
*/ &A)B~"[~
public class CountBean { A~+S1
private String countType; '|*?*6q
int countId; Yd= a}T
/** Creates a new instance of CountData */ 9^Whg~{
public CountBean() {} k^%B5
public void setCountType(String countTypes){ )m{Ye0!RD
this.countType=countTypes; AUNQA
} {h2TD
P
public void setCountId(int countIds){ pT1[<X!<s
this.countId=countIds; S_v'hlrrT
} 9Xl5@%uz?z
public String getCountType(){ 4*mS y
return countType; 6{+{lBm=y
} \eb|eN0i
public int getCountId(){ &q