Pagination With Php using Redis DB -


i want display list of customers pagination.structure of db follow:

redis:> hset customerlist username userid (where username:almas userid:1) redis:> hmset customerlog:1 userid value1 name value2 contactno value3 (where value1:1 , value2: almas sayyad, value3: 8676756556) 

i have used hash set , want continue same datatype. greatfull if 1 can give me solution this.

tl;dr paginating hash isn't trivial - should consider using different data structure more suitable task, namely sorted set.

hashes have no order , way sanely iterate fields hscan. however, scanning unordered, can return duplicates , number of results each call varies - building pagination mechanism on top of challenging , inefficient.

you can keep data, i.e. users, in hash, store field names in sorted set well. can give each user score order them or use lexicographical ordering - either way, you'll able paginate sorted set.


Comments

Popular posts from this blog

scala - 'wrong top statement declaration' when using slick in IntelliJ -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

PySide and Qt Properties: Connecting signals from Python to QML -