有时要为每一篇文章统计其点击次数,如果每一次浏览都要更新一次库的话,那性能在访问量很大的情况下,服务器的压力就会很大了,比较好一点的方法就是先将要更新的数据缓存起来,然后每隔一段时间再利用数据库的批量处理,批量更新库。源码如下: x2gP, p-
~.w Db,*
CountBean.java )z#M_[zC>
]w=6.LzO*
/* *!y.!v*
* CountData.java lhA<wV1-9G
* zx{O/v
KG
* Created on 2007年1月1日, 下午4:44 hq^@t6!C\m
* pJ 1Q~tI
* To change this template, choose Tools | Options and locate the template under A?xb
u*zV,
* the Source Creation and Management node. Right-click the template and choose 2x*C1
* Open. You can then make changes to the template in the Source Editor. %Sdzr!I7*
*/
b(~
gQM
h}_1cev?
package com.tot.count; B:\TvWbu
9v<Sng
/** :i6k6=
* -cHX3UAEI
* @author ?geEq'
*/ O$=)
public class CountBean { mJ|7Jc
private String countType; H19CVc\B
int countId; k98}Jx7J)"
/** Creates a new instance of CountData */ L){rv)?="
public CountBean() {} 6A& f
public void setCountType(String countTypes){ k&1~yW
this.countType=countTypes; :bA@
u>
} AT{ewb
public void setCountId(int countIds){ X;ZR"YgT
this.countId=countIds; "kjjq~l
} SAEr $F^
public String getCountType(){ &n:F])`2
return countType; yv<