1 24 package org.riotfamily.website.cache; 25 26 import java.lang.reflect.Method ; 27 28 import org.riotfamily.cachius.Cache; 29 import org.riotfamily.riot.dao.RiotDao; 30 import org.springframework.aop.AfterReturningAdvice; 31 import org.springframework.util.Assert; 32 33 public class CacheInvalidationAdvice implements AfterReturningAdvice { 34 35 private Cache cache; 36 37 public void setCache(Cache cache) { 38 this.cache = cache; 39 } 40 41 public void afterReturning(Object returnValue, Method method, 42 Object [] args, Object target) throws Throwable { 43 44 Assert.isInstanceOf(RiotDao.class, target); 45 RiotDao dao = (RiotDao) target; 46 Object item = args[0]; 47 CacheInvalidationUtils.invalidate(cache, dao, item); 48 } 49 50 } 51 | Popular Tags |