有时要为每一篇文章统计其点击次数,如果每一次浏览都要更新一次库的话,那性能在访问量很大的情况下,服务器的压力就会很大了,比较好一点的方法就是先将要更新的数据缓存起来,然后每隔一段时间再利用数据库的批量处理,批量更新库。源码如下: v)du]
kc2B_+Y1
CountBean.java i`sZP#h
MM32\}Y6
/* :5~Dca_iU4
* CountData.java 1/9*c *w
* <9pI~\@w
* Created on 2007年1月1日, 下午4:44 IE \RP!
* @H?OHpJ"`
* To change this template, choose Tools | Options and locate the template under D=a*Xu2zq
* the Source Creation and Management node. Right-click the template and choose l\{Qnb(
* Open. You can then make changes to the template in the Source Editor. )W\)kDh!
*/ wnX;eU/n
viG= Ap.Th
package com.tot.count; .\a+m
]x
metv|7
/** 55O}S Us!P
* VjWJx^ZL#
* @author Hi[lN7ma8
*/ q<E7qY+
public class CountBean { c/K#W$ l
private String countType; HHx:s2G
int countId; 6h/!,j0:t_
/** Creates a new instance of CountData */ l5w^rj
public CountBean() {} tQzbYzGb7
public void setCountType(String countTypes){ @M\JzV4 A[
this.countType=countTypes; !6|_`l>G,
} j4i$2ZT'
public void setCountId(int countIds){ K;"H$0!9
this.countId=countIds; WDY\Fj
} k H65k (
public String getCountType(){ )2).kL>
return countType; <o()14
} X{#^O/
public int getCountId(){ Mt4]\pMUb
return countId; HCOsVTl,
} =~O3j:<6
} .'M.yE~5J
my sXgS&