有时要为每一篇文章统计其点击次数,如果每一次浏览都要更新一次库的话,那性能在访问量很大的情况下,服务器的压力就会很大了,比较好一点的方法就是先将要更新的数据缓存起来,然后每隔一段时间再利用数据库的批量处理,批量更新库。源码如下: ?xEQ'(UBQ
(t&]u7Atr
CountBean.java j.FA!4L
4w,=6|#
/* _Gs*4:
* CountData.java uD4=1g6[s
* !`5[(lm
* Created on 2007年1月1日, 下午4:44 pRI<L'
* @P=St\;VP
* To change this template, choose Tools | Options and locate the template under @sQ^6FK0G
* the Source Creation and Management node. Right-click the template and choose +Qy*s1fit
* Open. You can then make changes to the template in the Source Editor. ~3byAL
*/ 0#(K}9T)
&y`
MDyXz
package com.tot.count; Y `4AML
1'ne[@i^/
/** sX&.8
* d"3S[_U
* @author tHNvb\MR$
*/ 50!/%
public class CountBean { w-2&6o<n-
private String countType; QZy+`
int countId; z_%G{H+:l
/** Creates a new instance of CountData */ we'<Y
public CountBean() {} D|-^}I4
public void setCountType(String countTypes){ 5G .Fi21
b
this.countType=countTypes; Bz}Dgbb
} 5
o:VixZf
public void setCountId(int countIds){ C${{&$&