瀏覽代碼

去掉session cache

wangliang 1 年之前
父節點
當前提交
64f69f2bd9
共有 1 個文件被更改,包括 10 次插入3 次删除
  1. 10 3
      sop-business/src/main/java/com/qmth/sop/business/cache/impl/CommonCacheServiceImpl.java

+ 10 - 3
sop-business/src/main/java/com/qmth/sop/business/cache/impl/CommonCacheServiceImpl.java

@@ -73,6 +73,9 @@ public class CommonCacheServiceImpl implements CommonCacheService {
     @Resource
     BasicSchoolService basicSchoolService;
 
+    @Resource
+    TBSessionService tbSessionService;
+
     /**
      * 添加用户缓存
      *
@@ -260,7 +263,9 @@ public class CommonCacheServiceImpl implements CommonCacheService {
      */
     @Override
     public void setUserSession(String sessionId, Object o) {
-        cacheService.put(SystemConstant.SESSION, sessionId, o);
+        //        cacheService.put(SystemConstant.SESSION, sessionId, o);
+        TBSession tbSession = (TBSession) o;
+        tbSessionService.updateById(tbSession);
     }
 
     /**
@@ -271,7 +276,8 @@ public class CommonCacheServiceImpl implements CommonCacheService {
      */
     @Override
     public Object getUserSession(String sessionId) {
-        return cacheService.get(SystemConstant.SESSION, sessionId);
+        //        return cacheService.get(SystemConstant.SESSION, sessionId);
+        return tbSessionService.getById(sessionId);
     }
 
     /**
@@ -281,7 +287,8 @@ public class CommonCacheServiceImpl implements CommonCacheService {
      */
     @Override
     public void deleteUserSession(String sessionId) {
-        cacheService.evict(SystemConstant.SESSION, sessionId);
+        //        cacheService.evict(SystemConstant.SESSION, sessionId);
+        tbSessionService.removeById(sessionId);
     }
 
     /**