class DecrementCounterInCacheAdvice extends CounterInCacheBase {

    @AfterReturning("decrementSingleCounter()")
    public void decrementSingle(final JoinPoint jp) throws Throwable {
        if (isDisabled()) {
            getLogger().info("Cache disabled");
            return;
        }
        // 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.
        // It will be invoked only if underlying method completes successfully.
        String cacheKey = null;
        DecrementCounterInCache annotation;
        try {
            Method methodToCache = getCacheBase().getMethodToCache(jp, DecrementCounterInCache.class);
            annotation = methodToCache.getAnnotation(DecrementCounterInCache.class);
            AnnotationData data = AnnotationDataBuilder.buildAnnotationData(annotation, DecrementCounterInCache.class, methodToCache);
            cacheKey = getCacheBase().getCacheKeyBuilder().getCacheKey(data, jp.getArgs(), methodToCache.toString());
            getCacheBase().getCache(data).decr(cacheKey, 1);
        } catch (Exception ex) {
            warn(ex, "Decrementing counter [%s] via %s aborted due to an error.", cacheKey, jp.toShortString());
        }
    }

}