有时要为每一篇文章统计其点击次数,如果每一次浏览都要更新一次库的话,那性能在访问量很大的情况下,服务器的压力就会很大了,比较好一点的方法就是先将要更新的数据缓存起来,然后每隔一段时间再利用数据库的批量处理,批量更新库。源码如下: {i;6vRr
N"1QX6
CountBean.java D:m#d.m
4U{m7[
/* +*.1}r&
* CountData.java 0Cq!\nzz
* d1bhJK
* Created on 2007年1月1日, 下午4:44 61|B]ei/
* mf2Mx=oy
* To change this template, choose Tools | Options and locate the template under p:tN642
* the Source Creation and Management node. Right-click the template and choose U|?,N0%Z1
* Open. You can then make changes to the template in the Source Editor. kFwxK"n@C
*/ L[]BzsIv
-_|]N/v\
package com.tot.count; oIxH 3T
x8/us
/** O^NP0E
* WK4@:k
m6)
* @author ^*>n4U
*/ -)RJ\V^{9
public class CountBean { I4~^TrznRa
private String countType; }e2F{pQ
int countId; zt?H~0$LB
/** Creates a new instance of CountData */ #HG&[Ywi
public CountBean() {} W>$BF[x!{
public void setCountType(String countTypes){ [pR)@$"k'
this.countType=countTypes; G#lg|# -#
} [+Un ^gD
public void setCountId(int countIds){ o(Kcs-W2
this.countId=countIds; [gZDQcU
} k%Eh{dA
public String getCountType(){ WHk/$7_"i
return countType; G"> 0]LQ
} +* D4(
public int getCountId(){ F[]&