package com.dxhy.common.util.redis;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.stereotype.Component;

import com.dxhy.common.utils.RRException;

import lombok.extern.slf4j.Slf4j;

/**
 * Redis切面处理类
 * 
 * @author jiaohongyang
 */
@Aspect
@Component
@Slf4j
public class RedisAspect {

    @Around("execution(* com.dxhy.common.util.redis.RedisUtils.*(..))")
    public Object around(ProceedingJoinPoint point) throws Throwable {
        Object result;
        try {
            result = point.proceed();
        } catch (Exception e) {
            log.error("redis error", e);
            throw new RRException("Redis服务异常");
        }
        return result;
    }
}
