有时要为每一篇文章统计其点击次数,如果每一次浏览都要更新一次库的话,那性能在访问量很大的情况下,服务器的压力就会很大了,比较好一点的方法就是先将要更新的数据缓存起来,然后每隔一段时间再利用数据库的批量处理,批量更新库。源码如下: H7\EvIM=
a]ftE\99
CountBean.java s\KV\5\o
xUeLX`73
/* \?GMtM,
* CountData.java Rq\.RR](
* 7Y$p3]0e+
* Created on 2007年1月1日, 下午4:44 icnp^2P
* Uh9$e
* To change this template, choose Tools | Options and locate the template under V=
.'Db2D
* the Source Creation and Management node. Right-click the template and choose 7d9%L}+q
* Open. You can then make changes to the template in the Source Editor. nNL9B~d
*/ 2pB@qi-]
g.,IQ4o
package com.tot.count; ci*Z9&eS+
,I)/ V>u
/** p~M^' k=d
* RE*SdazY?
* @author (A?e}M^}
*/ 7[8PSoo
public class CountBean { Ao=.=0os
private String countType; XRaq\a`=:
int countId; #5'9T:8
/** Creates a new instance of CountData */ }b~ZpUL!
public CountBean() {} q,+d\-+
public void setCountType(String countTypes){ tTP"*Bb
this.countType=countTypes; j4Lf6aUOX
} W**a\[~$
public void setCountId(int countIds){ ^S[Mg6J
this.countId=countIds; :;]6\/ky
} wLNO\JP'
public String getCountType(){ U*,5t81
return countType; :~g=n&x
} p+A#t~K
public int getCountId(){ ZG<