File tree Expand file tree Collapse file tree 3 files changed +15
-0
lines changed Expand file tree Collapse file tree 3 files changed +15
-0
lines changed Original file line number Diff line number Diff line change 33from dash .dependencies import Input , Output , State
44from flask import session
55from server import app
6+ from utils .cache_util import CacheManager
67
78
89# api拦截器——退出登录二次确认
1718def redirect_page (okCounts ):
1819 if okCounts :
1920 session .clear ()
21+ CacheManager .clear ()
2022
2123 return [dcc .Location (pathname = '/login' , id = 'index-redirect' ), None ]
2224
Original file line number Diff line number Diff line change 55from flask import session
66from api .login import LoginApi
77from server import app
8+ from utils .cache_util import CacheManager
89
910
1011# 页首右侧个人中心选项卡回调
@@ -58,6 +59,7 @@ def logout_confirm(okCounts):
5859 result = LoginApi .logout ()
5960 if result ['code' ] == 200 :
6061 session .clear ()
62+ CacheManager .clear ()
6163
6264 return [dcc .Location (pathname = '/login' , id = 'index-redirect' ), None ]
6365
Original file line number Diff line number Diff line change @@ -61,6 +61,17 @@ def delete(cls, target_key: str):
6161 cache .pop (target_key , None )
6262 cache_manager .insert (session .get ('Authorization' ), cache )
6363
64+ @classmethod
65+ def clear (cls ):
66+ """
67+ 清空缓存值
68+
69+ :return:
70+ """
71+ cache = cache_manager .get (session .get ('Authorization' ))
72+ if cache :
73+ del cache_manager [session .get ('Authorization' )]
74+
6475
6576class TTLCacheManager :
6677 """
You can’t perform that action at this time.
0 commit comments