Performance: @CacheEvict for invalidation
MEDIUM IMPACT
This affects how quickly updated data is reflected in the application by controlling cache freshness and memory usage.
@CacheEvict(value = "items", key = "#item.id") public void updateItem(Item item) { // update logic }
@CacheEvict(value = "items", allEntries = true)
public void updateItem(Item item) {
// update logic
}| Pattern | Cache Entries Evicted | Cache Misses | CPU Load | Verdict |
|---|---|---|---|---|
| Evict all entries on update | All | High | High | [X] Bad |
| Evict specific entry by key | One | Low | Low | [OK] Good |