@Aspect
@Service
@Slf4j
public class MadEvictCacheAspect {
@Autowired
private CacheManager cacheManager;
@Pointcut(value = "execution(* com.pty.mad.service..*.insert*(..))")
private void insertPointCut() {
}
@Pointcut(value = "execution(* com.pty.mad.service..*.del*(..))")
private void delPointCut() {
}
@Pointcut(value = "execution(* com.pty.mad.service..*.delete*(..))")
private void deletePointCut() {
}
@Pointcut(value = "execution(* com.pty.mad.service..*.remove*(..))")
private void removePointCut() {
}
@Pointcut(value = "execution(* com.pty.mad.service..*.update*(..))")
private void updatePointCut() {
}
@Pointcut(value = "execution(* com.pty.mad.service..*.save*(..))")
private void savePointCut() {
};
@Pointcut(value = "execution(* com.pty.mad.service..*.*Issue*(..))")
private void issuePointCut() {
}
@Pointcut(value = "execution(* com.pty.mad.service..*.issue*(..))")
private void issuePointCut2() {
}
@Pointcut(value = "execution(* com.pty.mad.service..*.disEnable*(..))")
private void disEnablePointCut() {
}
@Pointcut(value = "execution(* com.pty.mad.service..*.enable*(..))")
private void enablePointCut() {
}
@Pointcut(value = "execution(* com.pty.mad.service..*.able*(..))")
private void ablePointCut() {
}
@Pointcut(value = "execution(* com.pty.mad.service..*.modify*(..))")
private void modifyPointCut() {
}
@Pointcut(value = "execution(* com.pty.mad.service..*.change*(..))")
private void changePointCut() {
}
@After("insertPointCut() || delPointCut() || deletePointCut() || removePointCut() || updatePointCut() || savePointCut() || issuePointCut() ||issuePointCut2() || disEnablePointCut() || enablePointCut() || ablePointCut() || modifyPointCut()")
public void clearMadCache(JoinPoint joinPoint) {
try {
cacheManager.getCache(MadConstants.MAD_CACHE_NAME).clear();
} catch (Exception ex) {
log.error("clear mad cache error:", ex);
}
}
}
缓存切面
最新推荐文章于 2021-11-17 12:23:24 发布