Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sa-token-redis需优化searchData方法,默认使用了keys #702

Open
onetiaoxianfish opened this issue Nov 10, 2024 · 0 comments
Open

Comments

@onetiaoxianfish
Copy link

对以下问题有疑问:

sa-token-redis的插件内部实现下述方法时,使用了redisTemplate.keys,此方法会使用redis的keys指令,有导致redis线上卡死的风险,应该手动实现scan去检索,另外部分生产服务器redis配置会禁用keys,同样会导致无法使用。

	/**
	 * 搜索数据 
	 */
	@Override
	public List<String> searchData(String prefix, String keyword, int start, int size, boolean sortType) {
		Set<String> keys = stringRedisTemplate.keys(prefix + "*" + keyword + "*");
		List<String> list = new ArrayList<>(keys);
		return SaFoxUtil.searchList(list, start, size, sortType);
	}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant