有时要为每一篇文章统计其点击次数,如果每一次浏览都要更新一次库的话,那性能在访问量很大的情况下,服务器的压力就会很大了,比较好一点的方法就是先将要更新的数据缓存起来,然后每隔一段时间再利用数据库的批量处理,批量更新库。源码如下: ';3>rv_
4;6"I2;zfG
CountBean.java @} r*KF-
PaaMh[OmG
/* B~I ]3f
* CountData.java E{T3Xwg
* |KhpF1/(
* Created on 2007年1月1日, 下午4:44 {'{}@CuA2
* mW"e
* To change this template, choose Tools | Options and locate the template under }!iopu
* the Source Creation and Management node. Right-click the template and choose MLV]+H[mt
* Open. You can then make changes to the template in the Source Editor. U2A-ub>7
*/ ec!e
PB^rniYh
package com.tot.count; w5i*pOG)Z
X"TL'"?fo
/** z\|<h=EU
* uU)t_W&-J
* @author >GIQT?O6
*/ QT%`=b
public class CountBean { Z?eTjkNS#
private String countType; NOTG|\{
int countId; -U2Su|:\N8
/** Creates a new instance of CountData */ (]q
([e
public CountBean() {} <#:iltO
public void setCountType(String countTypes){ oO
tjG3B({
this.countType=countTypes; &E]) sJ0
} ;-1KPDIp`
public void setCountId(int countIds){ dzIBdth
this.countId=countIds; < dE7+w
}
ck;:84
public String getCountType(){ 1O Ft}>1
return countType; lz`\Q6rZ
} &- p(3$jn7
public int getCountId(){ ~~{lIO)&