class InvalidateAssignCacheAdvice extends CacheAdvice {

    @Around("invalidateAssign()")
    public Object cacheInvalidateAssign(final ProceedingJoinPoint pjp) throws Throwable {
        if (isDisabled()) {
            getLogger().info("Cache disabled");
            return pjp.proceed();
        }

        final Object result = pjp.proceed();

        // This is injected caching. If anything goes wrong in the caching, LOG
        // the crap outta it, but do not let it surface up past the AOP injection itself.
        String cacheKey = null;
        try {
            final Method methodToCache = getCacheBase().getMethodToCache(pjp, InvalidateAssignCache.class);
            final InvalidateAssignCache annotation = methodToCache.getAnnotation(InvalidateAssignCache.class);
            final AnnotationData data = AnnotationDataBuilder.buildAnnotationData(annotation, InvalidateAssignCache.class, methodToCache);

            cacheKey = getCacheBase().getCacheKeyBuilder().getAssignCacheKey(data);

            getCacheBase().getCache(data).delete(cacheKey);
        } catch (Exception ex) {
            warn(ex, "Caching on method %s and key [%s] aborted due to an error.", pjp.toShortString(), cacheKey);
        }
        return result;
    }

}