7.4 EvictInterceptor
EvictInterceptor可以根据CacheName注解自动清除缓存。以下是示例代码:
- @Before(EvictInterceptor.class)
@CacheName("blogList")
public void update() {
getModel(Blog.class).update();
redirect("blog.html");
}
上例中的用法将清除cacheName为blogList的缓存数据,与其配合的CacheInterceptor会自动更新cacheName为blogList的缓存数据。