Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/unit-testing/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Spring 在事务提交后,如何才能执行“@cacheexecute”或“@CachePut”?_Spring_Caching - Fatal编程技术网

Spring 在事务提交后,如何才能执行“@cacheexecute”或“@CachePut”?

Spring 在事务提交后,如何才能执行“@cacheexecute”或“@CachePut”?,spring,caching,Spring,Caching,为什么Spring@cacheexecute和@CachePut在事务提交后不调用; 我认为这样,我们可以避免一些错误。例如,在逐出缓存和事务提交之间,调用一个@Cacheable调用,那么缓存中的值就是脏数据。 我看到了CacheInterceptor,但它看起来好像我无法重写它。有人可以告诉我,在事务提交后,我如何才能@cacheexecute或@CachePut?如果CacheManage扩展为AbstractTransactionSupportingCacheManager,您可以调用S

为什么Spring
@cacheexecute
@CachePut
在事务提交后不调用; 我认为这样,我们可以避免一些错误。例如,在逐出缓存和事务提交之间,调用一个
@Cacheable
调用,那么缓存中的值就是脏数据。
我看到了
CacheInterceptor
,但它看起来好像我无法重写它。有人可以告诉我,在事务提交后,我如何才能
@cacheexecute
@CachePut
?如果
CacheManage
扩展为
AbstractTransactionSupportingCacheManager
,您可以调用
SetTransactionware(true)
,然后在事务提交后@Cache调用

如果
CacheManage
扩展为
AbstractTransactionSupportingCacheManager
,您可以调用
SetTransactionWare(true)
,然后在事务提交后@Cache invoke