@Around("@annotation(loxia.support.cache.annotation.Cacheable)")
public Object doGet(ProceedingJoinPoint pjp) throws Throwable{
Method m = getMethod(pjp, Cacheable.class);
Map<String, Object> params = getParams(m, pjp.getArgs());
Cacheable c = m.getAnnotation(Cacheable.class);
String methodName = c.value().equals("") ? EncodeUtil.intToBase62(m.getDeclaringClass().getSimpleName().hashCode()) + "."
+ EncodeUtil.intToBase62(m.getName().hashCode()) : c.value();
/*
* String methodName = c.value().equals("") ? m.getDeclaringClass().getSimpleName() + "." + m.getName() : c.value();
*/
String cacheKey = getCacheKey(methodName, params);
logger.debug("get cache with key: {}", cacheKey);
Object value = cacheClient.get(cacheKey);
if (value != null){
if (value instanceof NullObject)
value = null;
logger.debug("Cached value: {} will be returned as type {} with key [{}]", new Object[] { value, m.getReturnType(), cacheKey });
return value;
}else{
value = pjp.proceed(pjp.getArgs());
cacheValue(methodName, c.cacheKey(), cacheKey, value == null ? NULL : value, c.expire(), params);
return value;
}
}