有时要为每一篇文章统计其点击次数,如果每一次浏览都要更新一次库的话,那性能在访问量很大的情况下,服务器的压力就会很大了,比较好一点的方法就是先将要更新的数据缓存起来,然后每隔一段时间再利用数据库的批量处理,批量更新库。源码如下: ku*|?uF
~9qDmt,i
CountBean.java |52VHW8c
vm+EzmO,!
/* BCya5!uy
* CountData.java _Gy*" ;E
* AM}-dKei|
* Created on 2007年1月1日, 下午4:44 t_YiF%}s
*
3\FiQ/?
* To change this template, choose Tools | Options and locate the template under @ :i>q$aF
* the Source Creation and Management node. Right-click the template and choose J=/|iW
* Open. You can then make changes to the template in the Source Editor. j0sR]i
*/ voaRh@DZ%/
F!VC19<1O8
package com.tot.count; 17G7r\iNYq
$Q|66/S^
/** d}b#"A
* f #414ja
* @author -5A@FGh
*/ H7)(<6b,z
public class CountBean { ^HHJ.QR
private String countType; =5_8f
int countId; 7/(C1II.Q
/** Creates a new instance of CountData */ ?x]T&S{
public CountBean() {} <;x+?j
public void setCountType(String countTypes){ dL")E|\\k
this.countType=countTypes; K:P gkc
} bTKzwNx
public void setCountId(int countIds){ '<m[
this.countId=countIds; 9Dd/g7
} A20_a;V
public String getCountType(){ .+aSa?h_
return countType; P/t$xqAL
} 0; OpT0
public int getCountId(){ NF0} eom
return countId; 2P9h x5PiV
} <