有时要为每一篇文章统计其点击次数,如果每一次浏览都要更新一次库的话,那性能在访问量很大的情况下,服务器的压力就会很大了,比较好一点的方法就是先将要更新的数据缓存起来,然后每隔一段时间再利用数据库的批量处理,批量更新库。源码如下: /Iu._2
A
fctycQ-
CountBean.java kM?p >V6
y]`@%V2P
/* &xqr&(o
* CountData.java B$ )6X
* -zVa[&
* Created on 2007年1月1日, 下午4:44 [\&Mo]"0
* 0|:Ic,
* To change this template, choose Tools | Options and locate the template under _r|$H_#
* the Source Creation and Management node. Right-click the template and choose M_4g%uHG
* Open. You can then make changes to the template in the Source Editor. PaFJw5f
*/ otO6<%/m
]Zim8^n?`.
package com.tot.count; hexq]' R
8D:{05
/** 5yQv(<~*G
* , &HZvU&
* @author ^"%SHs
*/
t=]&q.
public class CountBean { r\"O8\
private String countType; RfwTqw4@
int countId; sy`:wp
/** Creates a new instance of CountData */ #7U,kTj9
public CountBean() {} $E4W{ad2jW
public void setCountType(String countTypes){ K,}"v ;||
this.countType=countTypes; sHrpBm&O4
} (;a
O%
public void setCountId(int countIds){ J7.bFW'
this.countId=countIds; 1h+!<