dnno dnno - 1 year ago 197
Java Question

Spring Cache: Evict multiple caches

I'm using Spring Cache abstraction and I have multiple caches defined. Sometimes, when data changes, I want to evict more than one caches.
Is there away to evict multiple caches using Spring's @CacheEvict annotation?

Answer Source

You can do this:

@Caching(evict = { @CacheEvict("primary"), @CacheEvict(value = "secondary", key = "#p0") })

Check out the Reference for details

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download