Quellcode durchsuchen

rename 登录会话 cache key.

deason vor 2 Jahren
Ursprung
Commit
1f0a780684

+ 3 - 14
examcloud-api-commons/src/main/java/cn/com/qmth/examcloud/api/commons/security/bean/User.java

@@ -87,22 +87,11 @@ public class User implements JsonSerializable {
     private String salt;
 
     /**
-     * 构建key
-     *
-     * @return
-     * @author WANGWEI
+     * 构建用户Key(登录Session缓存KEY)
      */
-    public String buildKey() {
-        this.key = new StringBuilder()
-                .append("U_").append(userType.getCode())
-                .append("_").append(rootOrgId)
-                .append("_").append(userId)
-                .toString();
-        return this.key;
-    }
-
     public String getKey() {
-        return key;
+        this.key = "$SS:" + (userType != null ? userType.getCode() : "") + "_" + rootOrgId + "_" + userId;
+        return this.key;
     }
 
     public void setKey(String key) {

+ 13 - 0
examcloud-support/src/main/java/cn/com/qmth/examcloud/support/CacheConstants.java

@@ -7,6 +7,19 @@ package cn.com.qmth.examcloud.support;
  */
 public interface CacheConstants {
 
+    /* #################### 常用 #################### */
+
+    /**
+     * 缓存 - 登录会话前缀:{userType}_{rootOrgId}_{userId}
+     */
+    String CACHE_LOGIN_SESSION = "$SS:";
+
+    /**
+     * 缓存 - 锁前缀
+     */
+    String CACHE_LOCK = "$LOCK:";
+
+
     /* #################### 基础模块 #################### */
 
     /**