有时要为每一篇文章统计其点击次数,如果每一次浏览都要更新一次库的话,那性能在访问量很大的情况下,服务器的压力就会很大了,比较好一点的方法就是先将要更新的数据缓存起来,然后每隔一段时间再利用数据库的批量处理,批量更新库。源码如下: @680.+Kw
rW*[sLl3
CountBean.java 5$*=;ls>J
t]ID
/* 3.Jk-:u %m
* CountData.java k%;oc$0G-3
* ",S146Y+
* Created on 2007年1月1日, 下午4:44 ~@"H\):/
* tl=e!
* To change this template, choose Tools | Options and locate the template under D+Z2y1
* the Source Creation and Management node. Right-click the template and choose
$qiM_06
* Open. You can then make changes to the template in the Source Editor. *^ua2s.
*/ 2
yRUw
ixB"6O
package com.tot.count; n_6#Df*
\ns}
M3
/** iz27yXHZ~
* QGnUPiD^
* @author H^jcWwy:
*/ 9{-H/YS\_s
public class CountBean { ~b6c:db3
private String countType; ah#jvp
int countId; Gf-GDy\{
/** Creates a new instance of CountData */ cEGR?4z
public CountBean() {}
zw0u|q;#
public void setCountType(String countTypes){ Y,-!QFS#
this.countType=countTypes; X: QRy9]
} Axla@
public void setCountId(int countIds){ Y"TrF(C
this.countId=countIds; P6`LUyz3
} !_-Uwg
public String getCountType(){ x}O J~Yk]
return countType; n/%M9osF
} mJsU7bD`
public int getCountId(){ qU ,{jD$
return countId; )k81
} r<