有时要为每一篇文章统计其点击次数,如果每一次浏览都要更新一次库的话,那性能在访问量很大的情况下,服务器的压力就会很大了,比较好一点的方法就是先将要更新的数据缓存起来,然后每隔一段时间再利用数据库的批量处理,批量更新库。源码如下: A1uo@W
{Xw6p
CountBean.java NPY\ >pf
f&ri=VJY\T
/* &w"1VOV<
* CountData.java lwj,8
* 0<'Q;'2* L
* Created on 2007年1月1日, 下午4:44 P<s0f:".
* zvAUF8'_
* To change this template, choose Tools | Options and locate the template under SG@-b(
* the Source Creation and Management node. Right-click the template and choose 2T >K!jS
* Open. You can then make changes to the template in the Source Editor. H4{CiZ
*/ G>f2E49BXt
tQSJ"Q
package com.tot.count; 3d81]!n
-Mx\W|YK
/** BfOQ/k))
* !wNj;ST*
* @author 'wm :Xa
*/ >.4mAO
public class CountBean { \!Cc[n(f#
private String countType; Fx6]x$3
int countId; >xB[k-C4
/** Creates a new instance of CountData */ @eOD+h'
public CountBean() {} ) u
Sg;B4
public void setCountType(String countTypes){ 1
|T{RY5
this.countType=countTypes; jPc"qER!
} {Z!x]}{M
public void setCountId(int countIds){ pS6p}S=1]
this.countId=countIds; , tb\^
} DITo.PU
public String getCountType(){ "`q:
return countType; g+1&l iV
} "J(0J
public int getCountId(){ p;0p!~F=49
return countId; .0]\a~x
} 6zR9(c:a~
} *}<