有时要为每一篇文章统计其点击次数,如果每一次浏览都要更新一次库的话,那性能在访问量很大的情况下,服务器的压力就会很大了,比较好一点的方法就是先将要更新的数据缓存起来,然后每隔一段时间再利用数据库的批量处理,批量更新库。源码如下: skd3E4
#ujry.m
CountBean.java scf.>K2
(E{>L).~
/* q*L>MV
* CountData.java (Dy6I;S
* "!V-@F$@N
* Created on 2007年1月1日, 下午4:44 R`[jkJrc
* B]KR *
* To change this template, choose Tools | Options and locate the template under {iGy@?d)zt
* the Source Creation and Management node. Right-click the template and choose ?Uq;>
* Open. You can then make changes to the template in the Source Editor. Dq [f
*/ ~XzT~WxW
;PS V3Zh
package com.tot.count; $?_/`S13
rr@h9bak;g
/** @U8}K#
* I7@|{L1|FB
* @author jR1o<]?
*/ J0ysZ]
public class CountBean { 9HsiAi*
private String countType; 3V(]*\L
int countId; oZD+AF$R
/** Creates a new instance of CountData */ hTEwp.
public CountBean() {} pZ_zyI#wx_
public void setCountType(String countTypes){ >>cb0fH5
this.countType=countTypes; ; _ziRy
} i\zVP.c])*
public void setCountId(int countIds){ x0KW\<k
this.countId=countIds; <