package cn.reghao.oss.store.util;

/**
 * @author reghao
 * @date 2023-06-02 10:48:59
 */
public class UserContext implements AutoCloseable {
    static final ThreadLocal<Integer> CURRENT = new ThreadLocal<>();

    public UserContext(Integer user) {
        CURRENT.set(user);
    }

    public static int getUser() {
        return CURRENT.get();
    }

    @Override
    public void close() {
        CURRENT.remove();
    }
}
