有时要为每一篇文章统计其点击次数,如果每一次浏览都要更新一次库的话,那性能在访问量很大的情况下,服务器的压力就会很大了,比较好一点的方法就是先将要更新的数据缓存起来,然后每隔一段时间再利用数据库的批量处理,批量更新库。源码如下: w5~i^x
NSLVD[yT
CountBean.java v$|mo;6
wod/&!)]A
/* q{4|Kpx@
* CountData.java 1|y$~R.H
* h%#_~IA:|
* Created on 2007年1月1日, 下午4:44 V/#v\*JHFc
* /nB'kg[h\
* To change this template, choose Tools | Options and locate the template under 9fVj
8G
* the Source Creation and Management node. Right-click the template and choose KjR4=9MD
* Open. You can then make changes to the template in the Source Editor. R ZcH+?7
*/ s^C;>
{K.rl%_|N
package com.tot.count; ;( KMGir
j]> uZalr
/** L~0&
Q
* %jKH?%Ih
* @author ; h+ q
*/ X5E
'*W
public class CountBean { a&5g!;.
private String countType; 5RhF+p4
int countId; VO9f~>`(
/** Creates a new instance of CountData */ nP_=GI
public CountBean() {} I6w/0,azC
public void setCountType(String countTypes){ _g6wQdxT
this.countType=countTypes; u6_jnZGB
} m "]!I~jd
public void setCountId(int countIds){ r@$B'CsLj
this.countId=countIds; i:k-"
} ^![{,o@"A
public String getCountType(){ IA4+ad'\E
return countType; aJ-}
} 4I ,o&TK
public int getCountId(){ @&:VKpu\
return countId; V4?Oc2mS
} Qp 69Sk@H{
} |Y{PO&-?r
"t+r+ipf])
CountCache.java @zs1>\J7
cs5ix"1A
/* M71R -B`-
* CountCache.java (w2(qT&