有时要为每一篇文章统计其点击次数,如果每一次浏览都要更新一次库的话,那性能在访问量很大的情况下,服务器的压力就会很大了,比较好一点的方法就是先将要更新的数据缓存起来,然后每隔一段时间再利用数据库的批量处理,批量更新库。源码如下: |Uc_G13Y{D
,X`)ct
CountBean.java .K1FKC$C
8@MV%MVy$
/* vH :LQ!2
* CountData.java
zem8G2#c
* "eB$k40-
* Created on 2007年1月1日, 下午4:44 uM_wjP
* @`q:IIgW
* To change this template, choose Tools | Options and locate the template under h4T5+~rw
* the Source Creation and Management node. Right-click the template and choose lPw%ErG
* Open. You can then make changes to the template in the Source Editor. u>2
l7PA|
*/ 3h$6t7=C
<
HVl(O
package com.tot.count; ]~'5\58sP
(>nGQS]H
/** w9< R#y[A
* &L'Dqew,*
* @author {xXsBh
Y
*/ PHZ0P7
public class CountBean { =THpdtL
private String countType; fSK]|"c
int countId; ]:XoRyIZ1[
/** Creates a new instance of CountData */ ,$s8GAmq
public CountBean() {} n\*!CXc
public void setCountType(String countTypes){ ;$.J3!
this.countType=countTypes; Egg=yF>T
} m
qMHL2~
public void setCountId(int countIds){ A%KDiIA
this.countId=countIds; Z2qW\E^_r
} /5(Yy}
public String getCountType(){ Azl&m