
io.lsn.spring.utilities.middleware.cache.LoggingCacheInterceptor Maven / Gradle / Ivy
package io.lsn.spring.utilities.middleware.cache;
import org.aopalliance.intercept.MethodInvocation;
import org.apache.log4j.Logger;
import org.springframework.cache.interceptor.CacheInterceptor;
/**
* overridden CacheInterceptor to log return responses
*
* registered in your CacheConfiguration
* @author Patryk Szlagowski
*/
public class LoggingCacheInterceptor extends CacheInterceptor {
private final static Logger logger = Logger.getLogger(LoggingCacheInterceptor.class);
@Override
public Object invoke(MethodInvocation invocation) throws Throwable {
Object toReturn = super.invoke(invocation);
logger.info(new CacheableLog(invocation.getArguments(), toReturn));
return toReturn;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy