有时要为每一篇文章统计其点击次数,如果每一次浏览都要更新一次库的话,那性能在访问量很大的情况下,服务器的压力就会很大了,比较好一点的方法就是先将要更新的数据缓存起来,然后每隔一段时间再利用数据库的批量处理,批量更新库。源码如下: JeCEj=_Z
XlNB9\"5
CountBean.java z<P#djx
xhMdn3~U
/* 2I39fZa
* CountData.java ?Z7C0u#wd
* 8c$IsvJg
* Created on 2007年1月1日, 下午4:44 54LCoG/
* 9zd)[4%=
* To change this template, choose Tools | Options and locate the template under (C QgT3V
* the Source Creation and Management node. Right-click the template and choose J.`.lQ$z
* Open. You can then make changes to the template in the Source Editor. 55N/[{[
*/ a. 5`Q2
~JT{!wcE}o
package com.tot.count; e S
Fmx
;6)|'3.B9
/** CnA*o 8w
* Kd,m;S\
* @author XJOo.Y
*/ -)<Nd:A
public class CountBean { !8s:3]
private String countType; khu,P[3>
int countId; CGg6n CB
/** Creates a new instance of CountData */ D{z=)'/F
public CountBean() {} gf@'d.W}
public void setCountType(String countTypes){ aA
yFu_
this.countType=countTypes; ->#7_W
} @o^sp|k !
public void setCountId(int countIds){ AU$5"kBE
this.countId=countIds; %I=J8$B]f
} Y2D)$
public String getCountType(){ {5z?5i ?D
return countType; 9hp0wi@W}
} ,!py
n<_
public int getCountId(){ =O_[9kuJ
return countId; 02S(9^=
} ta4<d)nB
} Vis?cuU/
E0h!%/+-L
CountCache.java @+!d@`w:z2
9_/1TjrDN
/* U&a]gkr
* CountCache.java |)_<