关于cache的刷新

06-06-10 kia126
目前有一个功能是这样处理的,流程如下:

xxx.do?method=yyy ---> DispatchAction --> Service ---> Dao

在Dao里做一个UPDATE操作(根据ID,修改表的一个字段) --> 清空cache

log如下:

10:01:40,889 DEBUG [ProxyMethodInvocation] [JdonFramework]enter method reflection 
10:01:40,889 DEBUG [ProxyMethodInvocation] [JdonFramework] target:com.sunyark.service.ProductManagerImp service's method:insertMyFile running.. 
10:01:40,889 DEBUG [ProxyMethodInvocation] [JdonFramework] it is pojo target service
10:01:40,899 DEBUG [JdbcTemp] [JdonFramework]--> enter getSingleObject 
10:01:40,899 DEBUG [JdbcTemp] UPDATE  product SET filePath = ? where productId = ?
10:01:40,899 DEBUG [JdbcUtil] [JdonFramework] parameter 1 = xxx.pdf
10:01:40,899 DEBUG [JdbcUtil] [JdonFramework] parameter 2 = 192
10:01:41,100 DEBUG [PageIteratorSolver] [JdonFramework] clear the cache for the batch inquiry!
10:01:41,100 DEBUG [CacheManager] [JdonFramework]<-cache->remove the object of BLOCK0select productid  from  product where mpn like ? +%CS18LV40963DC-70% from cache
10:01:41,100 DEBUG [CacheManager] [JdonFramework]<-cache->remove the object of BLOCK0select count(1) from product where mpn like ? +%CS18LV40963DC-70% from cache
10:01:41,100 DEBUG [PageIteratorSolver] [JdonFramework] clear the cache for the batch inquiry!
10:01:41,100 DEBUG [MethodInvokerUtil] [JdonFramework] method invoke successfully 
10:01:41,100 DEBUG [PoolInterceptor] [JdonFramework] realease a object:com.sunyark.service.ProductManagerImp to pool
10:01:41,100 DEBUG [DynamicProxyWeaving] [JdonFramework]call method:insertMyFile finish!
<p>

问题:作完修改后,前台查询的时候,修改的字段值没有改变(数据库中值已经改变),为什么已经清空cache后前面的数据没有刷新?

我的分析:是不是因为此动作过程没有经过ModelHandler处理?

请banq老师帮忙分析一下.谢谢.

kia126
2006-06-10 12:54
附上查询时的log,如下:

12:32:36,230 DEBUG [ProxyMethodInvocation] [JdonFramework]enter method reflection 
12:32:36,230 DEBUG [ProxyMethodInvocation] [JdonFramework] target:com.sunyark.service.ProductManagerImp service's method:searchProducts running.. 
12:32:36,230 DEBUG [ProxyMethodInvocation] [JdonFramework] it is pojo target service
12:32:36,230 DEBUG [PageIteratorSolver] [JdonFramework]enter getPageIterator .. start= 0 count=30
12:32:36,230 DEBUG [BlockStrategy] [JdonFramework]enter getBlock .. 
12:32:36,230 DEBUG [CacheManager] [JdonFramework]<-cache->try to get cache: BLOCK0select productid  from  product where mpn like ? +%CS18LV40963DC-70%
12:32:36,230 DEBUG [BlockQueryJDBCTemp] [JdonFramework]--> fetch the primary key collection, sql sentence: select productid  from  product where mpn like ? +%CS18LV40963DC-70%
12:32:36,230 DEBUG [BlockQueryJDBCTemp] [JdonFramework]--> blockStart=0 blockSize=200
12:32:36,230 DEBUG [JdbcUtil] [JdonFramework] parameter 1 = %CS18LV40963DC-70%
12:32:36,230 DEBUG [BlockQueryJDBCTemp] [JdonFramework]--> found a primary key = 192,  type:java.lang.String
12:32:36,230 DEBUG [BlockQueryJDBCTemp] [JdonFramework]--> get a result succefully ..
12:32:36,230 DEBUG [UtilCache] [JdonFramework]cache now size = 1 maxSize =1000 this Cache id:14330646
12:32:36,230 DEBUG [CacheManager] [JdonFramework]<-cache->save cache: BLOCK0select productid  from  product where mpn like ? +%CS18LV40963DC-70%, size:1
12:32:36,230 DEBUG [BlockStrategy] [JdonFramework] getBlockKeys, size=1
12:32:36,230 DEBUG [BlockStrategy] [JdonFramework] lastCount=1
12:32:36,230 DEBUG [BlockStrategy] [JdonFramework]got a Block1
12:32:36,230 DEBUG [CacheManager] [JdonFramework]<-cache->try to get cache: BLOCK0select count(1) from product where mpn like ? +%CS18LV40963DC-70%
12:32:36,230 DEBUG [BlockQueryJDBCTemp] [JdonFramework]--> execute fetch all count for sql sentence: select count(1) from product where mpn like ? 
12:32:36,270 DEBUG [JdbcUtil] [JdonFramework] parameter 1 = %CS18LV40963DC-70%
12:32:36,280 DEBUG [BlockQueryJDBCTemp] [JdonFramework]--> fetchDataAllCount is1
12:32:36,280 DEBUG [UtilCache] [JdonFramework]cache now size = 2 maxSize =1000 this Cache id:14330646
12:32:36,280 DEBUG [CacheManager] [JdonFramework]<-cache->save cache: BLOCK0select count(1) from product where mpn like ? +%CS18LV40963DC-70%, size:2
12:32:36,280 DEBUG [PageIteratorSolver] [JdonFramework]currentBlock: startIndex=0 endIndex=1 keys length=1
12:32:36,280 DEBUG [MethodInvokerUtil] [JdonFramework] method invoke successfully 
12:32:36,280 DEBUG [PoolInterceptor] [JdonFramework] realease a object:com.sunyark.service.ProductManagerImp to pool
12:32:36,280 DEBUG [DynamicProxyWeaving] [JdonFramework]call method:searchProducts finish!
12:32:36,280 DEBUG [ModelListAction] [JdonFramework] getCache from db. 
12:32:36,280 DEBUG [PicoContainerWrapper] [JdonFramework]lookup: name=webServiceFactory
12:32:36,280 DEBUG [PicoContainerWrapper] [JdonFramework]lookup: name=targetMetaDefLoader
12:32:36,280 DEBUG [TargetMetaDefXmlLoader] [JdonFramework]metaDefs size:18
12:32:36,280 DEBUG [WebServiceFactory] [JdonFramework] getService found :productManager
12:32:36,280 DEBUG [PicoContainerWrapper] [JdonFramework]lookup: name=visitorFactory
12:32:36,280 DEBUG [PicoContainerWrapper] [JdonFramework]lookup: name=sessionContextSetup
12:32:36,280 DEBUG [HttpRequestUserSetup] [JdonFramework] set principal name:REMOTE_ADDRESS=127.0.0.1
12:32:36,280 DEBUG [ServiceAccessorImp] [JdonFramework] enter getService: proxyInstanceFactoryVisitable in action
12:32:36,280 DEBUG [HttpSessionProxyVisitor] [JdonFramework] get the optimized instance for the key com.sunyark.service.ProductManagerImpproxyInstanceFactoryVisitable
12:32:36,280 DEBUG [DynamicProxyWeaving] [JdonFramework]call method:com.sunyark.service.ProductManager.getProduct
12:32:36,280 DEBUG [AopClient] [JdonFramework] enter AOP invoker2 for:com.sunyark.service.ProductManagerImp method:getProduct
12:32:36,280 DEBUG [AdvisorChainFactory] [JdonFramework] enter  create PointcutAdvisor  
12:32:36,280 DEBUG [AdvisorChainFactory] [JdonFramework] find all service's interceptos size=1
12:32:36,280 DEBUG [AdvisorChainFactory] [JdonFramework] find pojoService's interceptos size=5
12:32:36,280 DEBUG [ProxyMethodInvocation] [JdonFramework] method.getName() :getProduct
12:32:36,280 DEBUG [AopClient] [JdonFramework] MethodInvocation will proceed ... 
12:32:36,280 DEBUG [ProxyMethodInvocation] [JdonFramework] <-----> enter ProxyMethodInvocation proceed() for -1
12:32:36,280 DEBUG [ProxyMethodInvocation] [JdonFramework] now call inteceptor : com.jdon.aop.interceptor.CacheInterceptor
12:32:36,280 DEBUG [CacheInterceptor] [JdonFramework] enter cacheInteceptor method:getProduct
12:32:36,280 DEBUG [CacheManager] [JdonFramework]<-cache->try to get cache: Modelcom.sunyark.model.Product192
12:32:36,280 DEBUG [CacheManager] [JdonFramework]<-cache->got it
12:32:36,280 DEBUG [DynamicProxyWeaving] [JdonFramework]call method:getProduct finish!
12:32:36,280 DEBUG [ModelListAction] [JdonFramework] listForm 's property: getList size is 1
<p>

banq
2006-06-11 15:34
你修改时必定调用pageIterator的clearCache方法,但是这个pageIterator可能不是你查询是用的那个pageIterator。必须两者保持唯一。

kia126
2006-06-13 13:29
问题:

清空cache的前提下,调用同样一个查询方法getProduct(),为什么产生的日志不一样?

请帮助分析一下导致这种情况发生的原因,我弄了大半天天也没有找出来.

附上日志如下:

(1)

17:56:20,472 DEBUG [ProxyMethodInvocation] [JdonFramework] target:com.sunyark.service.ProductManagerImp service's method:getProduct running..

17:56:20,472 DEBUG [ProxyMethodInvocation] [JdonFramework] it is pojo target service

17:56:20,472 DEBUG [JdbcTemp] [JdonFramework]--> enter queryMultiObject

17:56:20,482 DEBUG [JdbcTemp] [JdonFramework]SELECT * FROM product WHERE productid = ?

17:56:20,482 DEBUG [JdbcUtil] [JdonFramework] parameter 1 = 890

17:56:20,482 DEBUG [MethodInvokerUtil] [JdonFramework] method invoke successfully

17:56:20,482 DEBUG [PoolInterceptor] [JdonFramework] realease a object:com.sunyark.service.ProductManagerImp to pool

17:56:20,482 DEBUG [CacheInterceptor] [JdonFramework] save to cache

17:56:20,482 DEBUG [ModelCacheManager] [JdonFramework]<-cache->try to save cache:

17:56:20,482 DEBUG [UtilCache] [JdonFramework]cache now size = 7 maxSize =1000 this Cache id:12646287

17:56:20,482 DEBUG [CacheManager] [JdonFramework]<-cache->save cache: Modelcom.sunyark.model.Product890, size:7

17:56:20,482 DEBUG [DynamicProxyWeaving] [JdonFramework]call method:getProduct finish!

17:56:20,482 DEBUG [ModelListAction] [JdonFramework] listForm 's property: getList size is 1

(2)

17:58:53,983 DEBUG [DynamicProxyWeaving] [JdonFramework]call method:com.sunyark.service.ProductManager.getProduct

17:58:53,983 DEBUG [AopClient] [JdonFramework] enter AOP invoker2 for:com.sunyark.service.ProductManagerImp method:getProduct

17:58:53,983 DEBUG [AdvisorChainFactory] [JdonFramework] enter create PointcutAdvisor

17:58:53,983 DEBUG [AdvisorChainFactory] [JdonFramework] find all service's interceptos size=1

17:58:53,983 DEBUG [AdvisorChainFactory] [JdonFramework] find pojoService's interceptos size=5

17:58:53,983 DEBUG [ProxyMethodInvocation] [JdonFramework] method.getName() :getProduct

17:58:53,983 DEBUG [AopClient] [JdonFramework] MethodInvocation will proceed ...

17:58:53,983 DEBUG [ProxyMethodInvocation] [JdonFramework] <-----> enter ProxyMethodInvocation proceed() for -1

17:58:53,983 DEBUG [ProxyMethodInvocation] [JdonFramework] now call inteceptor : com.jdon.aop.interceptor.CacheInterceptor

17:58:53,983 DEBUG [CacheInterceptor] [JdonFramework] enter cacheInteceptor method:getProduct

17:58:53,983 DEBUG [CacheManager] [JdonFramework]<-cache->try to get cache: Modelcom.sunyark.model.Product890

17:58:53,983 DEBUG [CacheManager] [JdonFramework]<-cache->got it

17:58:53,983 DEBUG [DynamicProxyWeaving] [JdonFramework]call method:getProduct finish!

17:58:53,993 DEBUG [ModelListAction] [JdonFramework] listForm 's property: getList size is 1

banq
2006-06-14 12:23
>调用同样一个查询方法getProduct(),为什么产生的日志不一样

一种你是通过代码直接调用,如xxService.getproduct();

二种是你没有写代码,JF通过你的jdonframework.xml中CRUD配置getProduct,使用方法发射机制调用的,类似method.invoke("类名","类方法名");

两条执行路径不一样,所以JF输出不一致。

猜你喜欢