Redis Set存储一批手机号,如何分页获取

使用 sscan 的时候如果set里存的value都是数字的话会返回所有存储的value。并不会根据count进行截取。
请问有人遇到过这个问题嘛?有什么办法能比较好的处理这个问题吗

clipboard.png

阅读 4.2k
2 个回答

When iterating Sets encoded as intsets (small sets composed of just integers), or Hashes and Sorted Sets encoded as ziplists (small hashes and sets composed of small individual values), usually all the elements are returned in the first SCAN call regardless of the COUNT value.

要范围获取的话还是换list,使用 Lrange 去获取

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进