ThreadLocalCache.java
1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package com.gsc4cloud.agentmanage.utils;
import com.gsc4cloud.agentmanage.response.rop.LoginAccountResponse;
import com.gsc4cloud.agentmanage.response.rop.LoginUserInfoResponse;
public class ThreadLocalCache {
// rop-dj-car-boutique
private static ThreadLocal<LoginUserInfoResponse> loginInfoCache = new ThreadLocal<LoginUserInfoResponse>();
// rop-dj-smartcarlife
private static ThreadLocal<LoginAccountResponse> LoginAccountInfoCache = new ThreadLocal<LoginAccountResponse>();
public static void setLoginAccountInfo(LoginAccountResponse loginAccountInfo) {
LoginAccountInfoCache.set(loginAccountInfo);
}
public static LoginAccountResponse getLoginAccountInfo() {
return LoginAccountInfoCache.get();
}
public static void removeLoginAccountInfo() {
LoginAccountInfoCache.remove();
}
public static void setLoginInfo(LoginUserInfoResponse loginInfo) {
loginInfoCache.set(loginInfo);
}
public static LoginUserInfoResponse getLoginInfo() {
return loginInfoCache.get();
}
public static void removeLoginInfo() {
loginInfoCache.remove();
}
}