mirror of https://github.com/elunez/eladmin
parent
db63c953d4
commit
31b033afe8
|
@ -44,6 +44,8 @@ public class UserCacheManager {
|
||||||
* @return JwtUserDto
|
* @return JwtUserDto
|
||||||
*/
|
*/
|
||||||
public JwtUserDto getUserCache(String userName) {
|
public JwtUserDto getUserCache(String userName) {
|
||||||
|
// 转小写
|
||||||
|
userName = StringUtils.lowerCase(userName);
|
||||||
if (StringUtils.isNotEmpty(userName)) {
|
if (StringUtils.isNotEmpty(userName)) {
|
||||||
// 获取数据
|
// 获取数据
|
||||||
return redisUtils.get(LoginProperties.cacheKey + userName, JwtUserDto.class);
|
return redisUtils.get(LoginProperties.cacheKey + userName, JwtUserDto.class);
|
||||||
|
@ -57,6 +59,8 @@ public class UserCacheManager {
|
||||||
*/
|
*/
|
||||||
@Async
|
@Async
|
||||||
public void addUserCache(String userName, JwtUserDto user) {
|
public void addUserCache(String userName, JwtUserDto user) {
|
||||||
|
// 转小写
|
||||||
|
userName = StringUtils.lowerCase(userName);
|
||||||
if (StringUtils.isNotEmpty(userName)) {
|
if (StringUtils.isNotEmpty(userName)) {
|
||||||
// 添加数据, 避免数据同时过期
|
// 添加数据, 避免数据同时过期
|
||||||
long time = idleTime + RandomUtil.randomInt(900, 1800);
|
long time = idleTime + RandomUtil.randomInt(900, 1800);
|
||||||
|
@ -71,6 +75,8 @@ public class UserCacheManager {
|
||||||
*/
|
*/
|
||||||
@Async
|
@Async
|
||||||
public void cleanUserCache(String userName) {
|
public void cleanUserCache(String userName) {
|
||||||
|
// 转小写
|
||||||
|
userName = StringUtils.lowerCase(userName);
|
||||||
if (StringUtils.isNotEmpty(userName)) {
|
if (StringUtils.isNotEmpty(userName)) {
|
||||||
// 清除数据
|
// 清除数据
|
||||||
redisUtils.del(LoginProperties.cacheKey + userName);
|
redisUtils.del(LoginProperties.cacheKey + userName);
|
||||||
|
|
Loading…
Reference in New Issue