package org.lingniu.idp.constant;

/**
 * 缓存的key 常量
 *
 */
public class CacheConstants
{
    public static final String prefix = "idp_";
    /**
     * 登录用户 redis key
     */
    public static final String LOGIN_TOKEN_KEY = prefix + "login_tokens:";

    /**
     * 验证码 redis key
     */
    public static final String CAPTCHA_CODE_KEY = prefix + "captcha_codes:";

    /**
     * 参数管理 cache key
     */
    public static final String SYS_CONFIG_KEY = prefix + "sys_config:";

    /**
     * 字典管理 cache key
     */
    public static final String SYS_DICT_KEY = prefix + "sys_dict:";

    /**
     * 防重提交 redis key
     */
    public static final String REPEAT_SUBMIT_KEY = prefix + "repeat_submit:";

    /**
     * 限流 redis key
     */
    public static final String RATE_LIMIT_KEY = prefix + "rate_limit:";

    /**
     * 登录账户密码错误次数 redis key
     */
    public static final String PWD_ERR_CNT_KEY = prefix + "pwd_err_cnt:";

    // Access Token存储: String结构
    // 格式: access_token:{token}
    public static final String ACCESS_TOKEN_KEY = prefix + "access_token:%s";

    // Refresh Token存储: Hash结构
    // 格式: refresh_token:{token}
    public static final String REFRESH_TOKEN_KEY = prefix + "refresh_token:%s";

    // 用户会话管理
    public static final String USER_SESSIONS = prefix + "user_sessions:%s"; // userId -> session列表
}
