Redis Hash Pagination

别等时光非礼了梦想. 提交于 2019-12-07 18:17:17

问题


I am using the Redis Hash, in which I am storing student id as the key (which is not numeric), the value is POJO of student data. now I need redis-pagination i.e. I don't care about the students' order but I want to fetch only some students data in one go. can I do this in Redis? if for supporting the pagination some modification in the data structure is required that would be ok too.

P.S. I am using spring-data-redis. but the solution without it would be ok too. basically, I want to find out whether redis supports pagination for hashes.


回答1:


Sounds like you are looking for the HSCAN command, which lets you page through a hash using a cursor. It has the same interface as the global key SCAN command, so look there for examples.

I'm not familiar with spring-data-redis but it might have some nice wrapper for this functionality. Otherwise, drop down to whatever redis library it runs on and execute it directly.



来源:https://stackoverflow.com/questions/46954129/redis-hash-pagination

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!