有时要为每一篇文章统计其点击次数,如果每一次浏览都要更新一次库的话,那性能在访问量很大的情况下,服务器的压力就会很大了,比较好一点的方法就是先将要更新的数据缓存起来,然后每隔一段时间再利用数据库的批量处理,批量更新库。源码如下: Y(ly0U}
dy;Ue5
CountBean.java C ".&m
ZJ@M}-4O1
/* #[C|%uq
* CountData.java 8l0%:6XbI
* 0ejx;Mum
* Created on 2007年1月1日, 下午4:44 CE:TQzg
* *[(O&L&0
* To change this template, choose Tools | Options and locate the template under fP%hr gL
* the Source Creation and Management node. Right-click the template and choose >Qz#;HI
* Open. You can then make changes to the template in the Source Editor. l2U"4d!o
*/ 1g5%Gr/0$5
5V4Ze;K
package com.tot.count; z,[4BM
|AW[4Yn>
/** P*XLm
* K_',Gd4L
* @author V6?ku6k
*/ $%"i|KTsv:
public class CountBean { wj9CL1Gx
private String countType;
qm&}^S
int countId; Id(o6j^J_
/** Creates a new instance of CountData */ =xWZJ:UnU
public CountBean() {} UMuqdLaT9
public void setCountType(String countTypes){ 8P0XY
S@
this.countType=countTypes; ~mx me6"v
} 7OG=LF*V-
public void setCountId(int countIds){ M2_sxibI
this.countId=countIds; jzSh|a9_
} ]d}Z2I'
public String getCountType(){
cHs@1R/-s
return countType; $R%xeih1fz
} [WnX'R R
public int getCountId(){ $&