Jan 5th, 2013, 01:29 AM
Got Problem When Use Spring Cache Annotation with Transactional Annotation
I come across a strange problem those days. I use spring cache annotation to enable data cache in our application, use memcached server for cache store, use transactional annotation to enable database transaction.
We annotate CacheEvict and Transactional on the same method, called method A, method A was invoked from anthor method annotated with Transactional, called method B, because of transaction propagatation, the data in the database was deleted after the method B finished, but the cache was evicted when method A finished, that is the problem: if some method invoke the method that put the data in cache when A finished but B is not finished, the data is in cache again, that result in the cache is not synced with database.
Is someone have the same situation? Can you share the solution with me ?
Tags for this Thread