I have a situation where I have 2 annotations applied to a DAO method. Each annotation has a specific aspect tied to it. One aspect for @FilterMe takes the resulting list of getMyObjects and returns a subset of that list depending on some real-time information. The @Cacheable aspect adds the resulting list to the cache and will use the cache if the list is currently valid. That's implemented through an Around advice..
See below.
And 2 Aspects written for each annotationCode:@FilterMe @Cacheable List getMyObjects() { //do something }
@Cacheable(Around advice)
@FilterMeCode:@Around(value = "within(com.client.cwp..*) && @annotation(com.client.cwp.component.caching.annotation.Cacheable)", argNames = "jp") public Object lookupCacheObjects(ProceedingJoinPoint jp) throws Throwable { }
My problem is that I always need the @Cacheable advice to fire first. In other words, I want the cache to return the FULL unfiltered list of content objects and THEN the @FilterMe aspect will filter the cached listings. What's happening is that my cache is returning the cached set of data the 2nd call regardless of any filtering going on in the @FilterMe. I think I need to guarantee that the cache always returns first, THEN the list is filtered.Code:@AfterReturning(value = "within(com.client.cwp.component.content.dao..*) && @annotation(com.client.cwp.component.content.annotation.FilterMe)", argNames = "jp, contentList", returning = "contentList") public void personlizeContent(JoinPoint jp, List<ContentTO> contentList) { //Filter }
Have people run into this type of situation before?


Reply With Quote