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

优化RedisList.Contains实现 #137

Open
nnhy opened this issue Sep 18, 2024 · 0 comments
Open

优化RedisList.Contains实现 #137

nnhy opened this issue Sep 18, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@nnhy
Copy link
Member

nnhy commented Sep 18, 2024

目前RedisList.Contains的实现是GetAll到本地内存,然后做内存判断是否存在。
数据量小(小于100个元素)的时候还好,数据多了性能会很差。

优化方案如下:
1,针对Redis7,使用新命令
image

2,针对Redis7以下,用LRANGE分批读取,逐个判断是否存在。批大小默认100。这样子可以避免GetAll返回所有数据。

@nnhy nnhy added the enhancement New feature or request label Sep 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant