package com.yanzuoguang.cloud.aop;

import java.util.Date;

/**
 * 请求缓存的数据
 * @author 颜佐光
 */
public class RequestCacheResult {

    /**
     * 构造函数
     */
    public RequestCacheResult(String reqID) {
        this.date = new Date();
        this.reqID = reqID;
        this.result = null;
    }

    /**
     * 请求编号
     */
    private String reqID;

    /**
     * 结果
     */
    private Object result;

    /**
     * 时间
     */
    private Date date;

    /**
     * 获取毫秒数
     *
     * @return
     */
    public long getMillsecond() {
        return System.currentTimeMillis() - date.getTime();
    }

    /**
     * 请求编号
     * @return
     */
    public String getReqID() {
        return reqID;
    }

    /**
     * 获取结果
     *
     * @return
     */
    public Object getResult() {
        return result;
    }

    /**
     * 返回结果
     *
     * @param result
     */
    public void setResult(Object result) {
        this.date = new Date();
        this.result = result;
    }
}