有时要为每一篇文章统计其点击次数,如果每一次浏览都要更新一次库的话,那性能在访问量很大的情况下,服务器的压力就会很大了,比较好一点的方法就是先将要更新的数据缓存起来,然后每隔一段时间再利用数据库的批量处理,批量更新库。源码如下: SI^!e1@M[
,_F@9Up
CountBean.java qwoF4_VN
(V!:6
/* [x{'NwP?
* CountData.java }f?$QSF
* R %aed>zo
* Created on 2007年1月1日, 下午4:44 M4~^tML>Ey
* .SAOE'Foo
* To change this template, choose Tools | Options and locate the template under :Z3Tyj}4
* the Source Creation and Management node. Right-click the template and choose W;P8=q
* Open. You can then make changes to the template in the Source Editor. :G!i]1x<
*/ . =yF
tHgu#k0
package com.tot.count; *S%~0=
WzDL(~m+Z
/** =c8xg/
* A]c'`Nf
* @author @FO=0_;y
*/ )O;6S$z9Y
public class CountBean { w&8N6gA14
private String countType; .hPk}B/KV
int countId; qT5q3 A(8
/** Creates a new instance of CountData */ Bi:%}8STH
public CountBean() {} ]
-iMo4H
public void setCountType(String countTypes){ avxr|uk
this.countType=countTypes; 9kZ[Z
,=>
} EhB0w; c
public void setCountId(int countIds){ <$metN~9j
this.countId=countIds; Y=6569U2
} `#Z=cq^_
public String getCountType(){ (_1(<Jw
return countType; 6&