有时要为每一篇文章统计其点击次数,如果每一次浏览都要更新一次库的话,那性能在访问量很大的情况下,服务器的压力就会很大了,比较好一点的方法就是先将要更新的数据缓存起来,然后每隔一段时间再利用数据库的批量处理,批量更新库。源码如下: C C;T[b&
:-fCyF)EI
CountBean.java y9cW&rDH
hl(M0cxEWP
/* ' jf$3
* CountData.java mg;+Th&
* C{`+h163\
* Created on 2007年1月1日, 下午4:44 )[.FUx
* \25Rq/&w
* To change this template, choose Tools | Options and locate the template under T<=Ci?C
v
* the Source Creation and Management node. Right-click the template and choose )+'FTz` c
* Open. You can then make changes to the template in the Source Editor. @{_[bKg
*/ U7bbJ>U_|
m}54yo
package com.tot.count; /. k4Y
d3v5^5kU
/** %AwR 4"M
* suC]
* @author _VLc1svv
*/ Eaf6rjD
public class CountBean { H~Xi;[{7
private String countType; k|(uIU* ]
int countId; F*_g3K!!
/** Creates a new instance of CountData */ xc7Wk&{=
public CountBean() {} f02<u
public void setCountType(String countTypes){ K;a]+9C
this.countType=countTypes; *e&OpVn
} :G=N|3
public void setCountId(int countIds){ 0,a\vs%@X
this.countId=countIds; 2MS1<VKZ@
} t:B~P,r
public String getCountType(){ Rf||(KC<
return countType; 7s+3^'
} A.8{LY;
public int getCountId(){ hsr,a{B%$
return countId; LmE%`qNg
} vq-Tq>
} ]:uJ&xUar