获取在线用户keys
This commit is contained in:
parent
c3070c9865
commit
40a263086a
|
@ -1,11 +1,15 @@
|
||||||
package net.maku.framework.security.cache;
|
package net.maku.framework.security.cache;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.ListUtil;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import net.maku.framework.common.cache.RedisCache;
|
import net.maku.framework.common.cache.RedisCache;
|
||||||
import net.maku.framework.common.cache.RedisKeys;
|
import net.maku.framework.common.cache.RedisKeys;
|
||||||
import net.maku.framework.security.user.UserDetail;
|
import net.maku.framework.security.user.UserDetail;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 认证 Cache
|
* 认证 Cache
|
||||||
*
|
*
|
||||||
|
@ -31,4 +35,11 @@ public class TokenStoreCache {
|
||||||
String key = RedisKeys.getAccessTokenKey(accessToken);
|
String key = RedisKeys.getAccessTokenKey(accessToken);
|
||||||
redisCache.delete(key);
|
redisCache.delete(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<String> getUserKeyList() {
|
||||||
|
String pattern = RedisKeys.getAccessTokenKey("*");
|
||||||
|
Set<String> sets = redisCache.keys(pattern);
|
||||||
|
|
||||||
|
return ListUtil.toList(sets);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user