有时要为每一篇文章统计其点击次数,如果每一次浏览都要更新一次库的话,那性能在访问量很大的情况下,服务器的压力就会很大了,比较好一点的方法就是先将要更新的数据缓存起来,然后每隔一段时间再利用数据库的批量处理,批量更新库。源码如下: {8e4TD9E0
T`W37fz0
CountBean.java c2~oPUj
XCyAt;neon
/* I7]qTS[vg
* CountData.java LUKt!I0l
* :=oIvSnh
* Created on 2007年1月1日, 下午4:44 aS/ MlMf
* =@*P})w5.
* To change this template, choose Tools | Options and locate the template under VlFhfOR6t
* the Source Creation and Management node. Right-click the template and choose "?Yf3G: \0
* Open. You can then make changes to the template in the Source Editor. B!AJ*
*/ Lg2z `uv
G_v^IM#B=
package com.tot.count; j}aU*p~N
7*C>4Gs
/** #v\o@ArX
* /#Lm)-%G
* @author &pFP=|Pq
*/ Y*-dUJK-`
public class CountBean { f5P@PG]{
private String countType; /L;
c -^
int countId; |'!9mvt=
/** Creates a new instance of CountData */ xz*MFoE
public CountBean() {} u,`cmyZ
public void setCountType(String countTypes){ +L-(Lz[p
this.countType=countTypes; Q60'5Wt
} 0NMmN_Lr
public void setCountId(int countIds){ ppR;v
this.countId=countIds; Rc#c^F<
} 4O'%$6KR(
public String getCountType(){ LPS]TG\
return countType; LNOz.2fr>
} H:4?sR3
public int getCountId(){ .q5WK#^
return countId; 5NN`tv
} Ry`Y +
} l5<&pb#b
1JY3c
M
CountCache.java OY,iz
8^5@J)R8
/* DpvMY94Qh
* CountCache.java Z3N^)j8
* zdgSqv
* Created on 2007年1月1日, 下午5:01 DlxL:
* A k+MREG
* To change this template, choose Tools | Options and locate the template under =S<