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.
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