有时要为每一篇文章统计其点击次数,如果每一次浏览都要更新一次库的话,那性能在访问量很大的情况下,服务器的压力就会很大了,比较好一点的方法就是先将要更新的数据缓存起来,然后每隔一段时间再利用数据库的批量处理,批量更新库。源码如下: m
|,ocz
Np|iXwl1
CountBean.java 8&ZUkDGkJ
. xX xjl
/* ,y2ur 2
* CountData.java xVKx#X9yk
* >Z|4/PF
* Created on 2007年1月1日, 下午4:44 G`mC=*Ma;
* r7*[k[^[^
* To change this template, choose Tools | Options and locate the template under ~srmlBi6
* the Source Creation and Management node. Right-click the template and choose a|5GC pp
* Open. You can then make changes to the template in the Source Editor. WLNkO^zb
*/ +zs;>'Sf
<g,k[
package com.tot.count; O(/K@e
1WcT>_$
/** J~<:yBup}
* 4pq >R
* @author ?Dm! ;Z+7
*/ H:9(
XW
public class CountBean { DfV_08
private String countType; wGISb\rr
int countId; ffm19 B=
/** Creates a new instance of CountData */ 3=dGz^Zdv:
public CountBean() {} gNs@Q!
public void setCountType(String countTypes){ 1
EC0wX
this.countType=countTypes; FL/y{;
} %
C6 H(
public void setCountId(int countIds){ #)>>f
this.countId=countIds; <