package com.ff.config;

import com.ff.common.domain.TenantSecretKey;
import org.springframework.stereotype.Component;

/**
 * 关键 工具
 *
 * @author shi
 * @date 2025/02/11
 */
@Component
public class KeyConfig {

    // 定义一个 ThreadLocal 变量，持有当前线程的全局变量
    private ThreadLocal<TenantSecretKey> threadLocalVariable = new ThreadLocal<>();

    /**
     * 设置
     *
     * @param value 价值
     */
    public void set(TenantSecretKey value) {
        threadLocalVariable.set(value);
    }


    /**
     * 得到
     *
     * @return {@link String }
     */
    public TenantSecretKey get() {
        return threadLocalVariable.get();
    }


    /**
     * 清楚
     */
    public void clear() {
        threadLocalVariable.remove();
    }
}
