有时要为每一篇文章统计其点击次数,如果每一次浏览都要更新一次库的话,那性能在访问量很大的情况下,服务器的压力就会很大了,比较好一点的方法就是先将要更新的数据缓存起来,然后每隔一段时间再利用数据库的批量处理,批量更新库。源码如下: A!!!7tj
[(*Eg!?W=
CountBean.java b(N\R_IQ~
Wx-0Ip'9
/* mF@7;dpr
* CountData.java hA 5p'a+K
* _(J#RH
* Created on 2007年1月1日, 下午4:44 V $I8iVGL
* %(
7##f_
* To change this template, choose Tools | Options and locate the template under P.Bwfa
* the Source Creation and Management node. Right-click the template and choose | I:@:
* Open. You can then make changes to the template in the Source Editor. !%65YTxY-
*/ LI.WcI3uS
ShC$ue?Q
package com.tot.count; ':_9o5I
wyX3qH
/** w3q'n%
* mTu>S
* @author QErdjjgE
*/ \9`E17i
public class CountBean { 7Q|<6210
private String countType; :8OT
int countId; 8:c=h/fa
/** Creates a new instance of CountData */ pdJ]V`m
public CountBean() {} b|.Cqsb
public void setCountType(String countTypes){ rtAPkXJFM
this.countType=countTypes; >(P(!^[f
} U:8]G
public void setCountId(int countIds){ z0LspRaz
this.countId=countIds; oQ-m
} "[7-1} l
public String getCountType(){ mmJnE
return countType; dz+!yE\f$
} RdD>&D$I
public int getCountId(){ $)NS]wJ]3
return countId; ~.3v\Q
} mhrF9&s
} s.7=!JQ#]p
v@ QnS
CountCache.java 9NwUXh(:(
`l'T/F\
/* o#6QwbU25
* CountCache.java |HT7m5tu4
* &C